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
AilleryO
Memorable Member
4 years agoYou can create one more VAR to store the MasterID.
VAR CurrentMasterID = MAX( MasterID )
and add a condition to the formula for table
&&MasterID = CurrentMasterID
dmarkie
4 years agoFrequent Visitor
sorry i'm not clear on the last step of adding the below condition to the formula for the table. The only formula i have is the DAX formula we are working on. Sorry for not understanding.
&&MasterID = CurrentMasterID
- AilleryO4 years ago
Memorable Member
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