Forum Discussion

TotunG's avatar
TotunG
Resolver I
3 years ago
Solved

Getting value which is second highest date through date relationship table

Hi,   I have a main data table which has a relationship with a reference date table that is used to 'slice' values to compare them in a waterfall chart.   I essentially need a measure to give me ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi TotunG ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create two measures. 

    rank = RANKX(ALLSELECTED('Main Data'),'Main Data'[Date],MAX('Main Data'[Date]),DESC,Dense)
    second highest date value = CALCULATE(MAX('Main Data'[Value]),FILTER(ALLSELECTED('Main Data'),'Main Data'[rank]=2))

    (3) Then the result is as follows.

    Best Regards,

    Neeko Tang

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