I have a table with lots of different dates in column DATE and a smaller number of letters in column LETTER. I now want the maximum date for each letter.

In DAX, I would use something like

`CALCULATE(MAX([Date]),FILTER(ALL(Table),[Letter]=EARLIER([Letter])).`

Is there an equivalent to EARLIER in M/Power Query? Oct 1, 2020 in Power BI 1,009 views

## 1 answer to this question.

Solutions in the code below. Notice that each uses "PreviousStep" as a basis, so these are separate solutions.

```let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
PreviousStep = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Letter", type text}}),

// 1. Add a column to the original table with the MaxDate for each letter
//    "earlier"  is just the name of a function parameter; it could as well have been "x" or "MarcelBeug"

// 2. Group by letter and get the MaxDate for each letter
GroupedOnLetter = Table.Group(PreviousStep, {"Letter"}, {{"MaxDate", each List.Max([Date]), type date}})
in
GroupedOnLetter``` answered Oct 1, 2020 by
• 65,850 points

## Dax query in power bi

Here is my table before I have ...READ MORE

## list reports with calculated percentage in Power BI using dax

Create a Measure called Total Revenue: Total Revenue = SUMX( ...READ MORE

## Power Query Web request results in “CR must be followed by LF” Error

What I think is, it might look ...READ MORE

## Select Columns from table instead of removing afterwards in Power Query

Try this. let db = Sql.Databases("sqlserver.database.url"){[Name="DatabaseName"]}[Data], Sales_vDimCustomer = ...READ MORE

## Using DAX calculation how to calculate monthly budget till today in power bi Desktop?

You can make use of this: MTD Budget ...READ MORE

## Understanding the DAX CALCULATE function

Using the CALCULATE function makes the DAX perform a context ...READ MORE

## DAX / PowerPivot query functions to spread aggregated values over time period

The solution below assumes a table called ...READ MORE

## DAX Userelationship function

You need a way for the measure ...READ MORE