Forum Discussion

JamesLeach's avatar
JamesLeach
Frequent Visitor
7 years ago
Solved

Calculated column or measure? Data from specific row for all rows matching value in another column.

Hello everyone!     I've got a data set similar to this (without the 'UniqueId' column - that's what I'm trying to add).   Record Data Value UniqueId 1 UniqueId 1001 1001 1 Thomas...
  • Greg_Deckler's avatar
    7 years ago

    As a calculated column, you could do this:

     

    UniqueID = 
    VAR __table = FILTER(ALL('Table2'),[Record]=EARLIER([Record]) && [Data]="UniqueId")
    RETURN
    MAXX(__table,[Value])

    As a measure, it would be:

     

    mUniqueID = 
    VAR __record = MAX([Record])
    VAR __table = FILTER(ALL('Table2'),[Record]=__record && [Data]="UniqueId")
    RETURN
    MAXX(__table,[Value])

    Assuming you put it in a visualization with at least Record.