Forum Discussion

Sasha's avatar
Sasha
Icon for Helper III rankHelper III
8 years ago
Solved

A diff between a measure and its implicit definition

Hi, As an example I have a table with Runs details where each row has a date, the number of a run and a specific km with its time. I also have a measure Best_1_km = MIN(RunsDetails[Time]) showing t...
  • Zubair_Muhammad's avatar
    8 years ago

    Sasha

     

    Actually MEASURE transforms a ROW context into Filter Context
    https://www.sqlbi.com/articles/understanding-context-transition/

    So in your case the MEASURE [Best_1_km] gets evlauated differently for every row of the RunsDetails Table

    If you store the MEASURE first in a variable and then apply this formula,, it will work

     

    Date_Best_1_km =
    VAR mybest = [Best_1_km]
    RETURN
        CALCULATE (
            MIN ( RunsDetails[Date] ),
            FILTER ( RunsDetails, RunsDetails[Time] = mybest )
        )