Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jsobrinho77
Creator
Creator

Only Aggr max date per each row max

Hi guys,

I need to show the max value per row by date, how can I do this?

In this case, I need to return the number 8 and the number 3

my measure:

aggr(distinct Only({<Date={"$(=Date(max(Date),'DD/MM/YYYY hh:mm:ss'))"}>}[Value]),Code,Date)

Jsobrinho77_0-1650272971011.png

 

Labels (3)
4 Replies
vinieme12
Champion III
Champion III

Expressions are evaluated only once per chart and not once per row,

basically you cannot have a different formula for each row in your table, Since each of your code may have a different max date, this is not possible

You will have to create a new field in your datamodel table to flag the max date for each code, and then refer to the flag field in set expression 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Jsobrinho77
Creator
Creator
Author

First of all, thank you for your answer

However, I have different dates for each code in my data model. I don't understand why I need a flag, and how can I use this in my expression.

Jsobrinho77_1-1650275984498.png

 

 

vinieme12
Champion III
Champion III

for row 1 the max date becomes 18/04/2022 10:18:17

for row 2 the max date becomes 18/04/2022 10:17:52

when you use Max() in chart it can only return one Max value to filter on, since the evaluation in set analysis happens for the entire chart not each row

since all your codes have different max dates it cannot evaluate a different filter for each dimension value in the chart

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Jsobrinho77
Creator
Creator
Author

I'm testing the firstsortedvalue, I think its working

FirstSortedValue([Value],-aggr(max( Date), Value))