Forum Discussion
dmarkie
4 years agoFrequent Visitor
MAXX Syntax and Locatin
Hi. Newer to DAX and still learning. I've read much and vids on Maxx but am having difficulty in achieving the desired outcome in this table creation. I have two tables linked on the MasterID fie...
- 4 years ago
No problem, sorry for not being more specific and anyway I was wrong, you should add the filter when you calulate max per MasterID, like :
Table =
VAR CurrentMasterID = MAX( [MasterID] )
VAR TempTable = FILTER (RELATEDTABLE(Detail), NOT ISBLANK('Detail'[VEHICLE ID]) && Detail[MasterID]>250 && CONTAINSSTRING(Detail[Description], "lof") )RETURNADDCOLUMNS( TempTable , "Last Date" , CALCULATE(MAXX( 'Detail', [Date]) , MasterID = CurrentMasterID )Let us know if it works
amitchandak
Super User
4 years agodmarkie , Are you creating a measure or column.
For measure, you can try like
calculate(Max(Master[Value]), FILTER ((Detail), NOT ISBLANK('Detail'[VEHICLE ID]) && Detail[MasterID]>250 && CONTAINSSTRING(Detail[Description], "lof")) )
dmarkie
4 years agoFrequent Visitor
In the Max(Master[Value]), there is not a DATE field in the MASTER table which is the 1 side of the relation. The DATE field which i need to retrieve the most recent date for each unique MasterID is located in the DETAIL table on the Many side.