Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Get latest value measure doesn't work in DirectQuery mode

Hello,   I'm trying to convert the power BI report data resource from Import to DirectQuery (Azure SQL). This measure is used to get the latest value for each category.     Measure = VAR Latest...
  • v-alq-msft's avatar
    6 years ago

    Hi, Anonymous 

     

    You may try the following measure to see if it helps.

    Measure =
    VAR LatestTime =
        CALCULATE ( 
             MAX ( 'Table'[Time] ), 
             FILTER ( 
                 ALLSELECTED('Table'), 
                 'Table'[Category] = 1 
             ) 
        )
    RETURN
        CALCULATE (
            AVERAGE ( 'Table'[Value] ),
            FILTER ( 
                   ALLSELECTED('Table'),
                   'Table'[Category] = 1&&
                   'Table'[Time]=LatestTime
            )       
        )
    

     

    About limitation and considerations in Direct Query mode, please refer to the document .

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.