0
votes

Within a Power BI report, I want to filter to the latest value in a column of timestamps. It is using a DirectQuery model so I can't use MAX in a calculate column, but I can use it in a measure. I need something along the lines of:

=IF(Query1[TimeStamp]=Calculate(Max(Query1[TimeStamp])),"Latest","")
1

1 Answers

3
votes

You can calculate the max for the whole column by removing the filter context:

CALCULATE(MAX(Query1[TimeStamp]), ALL(Query1[TimeStamp]))

The whole measure would look like this:

= IF(MAX(result[Fecha]) = CALCULATE(MAX(result[Fecha]), ALL(result[Fecha])),
    "Latest", "")