Forum Discussion

gunsmoke125's avatar
gunsmoke125
Regular Visitor
4 years ago
Solved

Help with getting the most recent non blank value

Hi Community,

 

I thought this would be quite a simple thing to achieve, but I've been at it for half a day without success.

 

I have a table with version data

I want to pull the latest non-blank value into table 2. The two tables are related via the GUID column on a 1:* (table 1 is unique, while table 2 has many) 

What is the most efficient way to achieve the desired outcome?

 

  • gunsmoke125,

     

    Try this calculated column in Table2:

     

    Value = 
    VAR vMaxVersionWithValue =
        CALCULATE ( MAX ( Table1[Version] ), Table1[Value] <> BLANK () )
    VAR vResult =
        CALCULATE ( MAX ( Table1[Value] ), Table1[Version] = vMaxVersionWithValue )
    RETURN
        vResult

     

     

    Data model:

     

     

1 Reply

  • gunsmoke125,

     

    Try this calculated column in Table2:

     

    Value = 
    VAR vMaxVersionWithValue =
        CALCULATE ( MAX ( Table1[Version] ), Table1[Value] <> BLANK () )
    VAR vResult =
        CALCULATE ( MAX ( Table1[Value] ), Table1[Version] = vMaxVersionWithValue )
    RETURN
        vResult

     

     

    Data model: