Forum Discussion

RavirajMSE's avatar
RavirajMSE
Frequent Visitor
3 years ago
Solved

How to apply max and if condition on multiple column?

  Look at this table,  Suppose I have given only three column Pot. No, Date, Shift. And this data gets appended every eight hours so you can see there are three shifts given over there so here I h...
  • mangaus1111's avatar
    3 years ago

    Hi RavirajMSE ,

    you can try this measure

    Measure = 
    VAR MaxDate= CALCULATE(MAX('Table'[Date]),ALL('Table'))
    VAR MaxShift = CALCULATE(MAX('Table'[Shift]),ALL('Table'))
    RETURN
    SWITCH(TRUE(),
          SELECTEDVALUE('Table'[Date]) = MaxDate && SELECTEDVALUE('Table'[Shift]) = MaxShift, "Latest Shift",
          "Not the latest Shift"
    )

     

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