Forum Discussion

ARMHCI's avatar
ARMHCI
Frequent Visitor
4 years ago
Solved

DAX return value based on Max value in a new column

Hi,    I have the following table    Number Gender GivenName Surname Family ID Assets Family_age 1 female Anna Friedman 3001 15,000 52 2 male Lelio Alonzo 3001 10,000 5...
  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi ARMHCI 
    You can try the following

     

    Age_Max_assets_per_family_ID =
    VAR CurrentIDTable =
        CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Family ID] ) )
    VAR MaxAsset =
        MAXX ( CurrentIDTable, Data[Assets] )
    VAR Result =
        MAXX ( FILTER ( CurrentIDTable, Data[Assets] = MaxAsset ), Data[Family_age] )
    RETURN
        Result

     

    In case of duplicates this code will return the maximum age. We can return the minumum or concatinate the results upon your requirement. Please let me know is this is ok with you.