Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Latest Phase

Hello,

Can someone help me? Please

What measurement could I use to consider the most recent phase per HF - Unidade?

In this example, the Help Flag phase was the most recent

 

  • Hello, Anonymous 
    You can do something like this (New Column in DAX)

    Measure = 
    var currentHF = table[HF_Unidade]
    var max_date = MAXX(FILTER(table, table[HF_Unidade] = currentHF), table[created_at])
    return MAXX(FILTER(table, table[created_at] = max_date && table[HF_Unidade] = currentHF ), table[current_phase])

     

3 Replies

  • Hello, Anonymous 
    You can do something like this (New Column in DAX)

    Measure = 
    var currentHF = table[HF_Unidade]
    var max_date = MAXX(FILTER(table, table[HF_Unidade] = currentHF), table[created_at])
    return MAXX(FILTER(table, table[created_at] = max_date && table[HF_Unidade] = currentHF ), table[current_phase])

     

  • You could create a measure as

    Most recent phase = 
    var HF = SELECTEDVALUE( 'Table'[HF - Unidade] )
    return SELECTCOLUMNS( CALCULATETABLE( TOPN( 1, 'Table' 'Table'[created_at]), 'Table'[HF - Unidade] = HF ), "@val", 'Table'[current_phase])