Forum Discussion
MAXX Syntax and Locatin
- 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
Hi,
Did you try to use ADDCOLUMNS, to create the column with the MAXX([Date]) function ?
Something like :
VAR TempTable = FILTER (RELATEDTABLE(Detail), NOT ISBLANK('Detail'[VEHICLE ID]) && Detail[MasterID]>250 && CONTAINSSTRING(Detail[Description], "lof"))
RETURN
ADDCOLUMNS( TempTable , "Last Date" , MAXX( Date ) )
Let us know if it works
Thank you.
I had not tried Adding a column so i attempted. The error reported Too Few agruments were passed to MAXX function. 2 is min req'd
- AilleryO4 years ago
Memorable Member
My mistake, the first argument is the table and the second one the column so it should have been in my formula :
MAXX( Detail , Date )
- dmarkie4 years agoFrequent Visitor
Thanks getting close....this yeilded the new column however the values are all the same (4/6/2022) for all the records for all the MasterIDs.
Here's the DAX as i have entered;
Table = VAR TempTable = FILTER (RELATEDTABLE(Detail), NOT ISBLANK('Detail'[VEHICLE ID]) && Detail[MasterID]>250 && CONTAINSSTRING(Detail[Description], "lof"))RETURNADDCOLUMNS( TempTable , "Last Date" , MAXX( 'Detail', [Date]) )- AilleryO4 years ago
Memorable Member
You can create one more VAR to store the MasterID.
VAR CurrentMasterID = MAX( MasterID )
and add a condition to the formula for table
&&MasterID = CurrentMasterID