Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Calculated measures comparing data by initial and final date

Good afternoon,   I am struggling with Power BI's calculated measures + data in tables. The problem I am trying to solve is the following:   The data has an Stated Update Date, which I have linke...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Anonymous,

    Create the following measures in your table.

    Mindate = CALCULATE(MIN(Table[Date]),ALLSELECTED(Table[Date]),ALL(Table[State New]),ALL(Table[State Old]))
    maxdate = CALCULATE(MAX(Table[Date]),ALLSELECTED(Table[Date]),ALL(Table[State New]),ALL(Table[State Old]))
    initial state = CALCULATE(FIRSTNONBLANK(Table[State Old],Table[State Old]),FILTER(Table,MIN(Table[Date])=[Mindate]))
    state = CALCULATE(FIRSTNONBLANK(Table[State New],Table[State New]),FILTER(Table,MAX(Table[Date])=[maxdate]))
    ifchange = IF([initial state]=[state],"No","Yes")

    I use the date field in the table to create a slicer.



    Regards,
    Lydia