Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello Community,
I'm a newbie who is interesting in Power Bi and the working of DAX.
Now I'm trying to get the penultimate record in a colum. Is there a function in DAX what can help me?
Please can anyone help me in achiving this measure.
Thanks,
Jeffrey
Solved! Go to Solution.
If you have a unique column in the table, like an ID, then you could do something like
Penultimate value =
VAR maxID =
MAX ( 'Table'[ID] )
VAR val =
SELECTCOLUMNS (
CALCULATETABLE ( TOPN ( 1, 'Table', 'Table'[ID] ), 'Table'[ID] < maxID ),
"@val", 'Table'[Desired column]
)
RETURN
val
Hi, You can filter out the row which has minium value then get the minimum value to find penultimate as below.
I hope this helps you.
Thanks
Hi,
Thank you for your answer.
I have tried:
And I need:
If you have a unique column in the table, like an ID, then you could do something like
Penultimate value =
VAR maxID =
MAX ( 'Table'[ID] )
VAR val =
SELECTCOLUMNS (
CALCULATETABLE ( TOPN ( 1, 'Table', 'Table'[ID] ), 'Table'[ID] < maxID ),
"@val", 'Table'[Desired column]
)
RETURN
val
Hi Johnt75,
Yes that looks like a solution. Thnx!
User | Count |
---|---|
50 | |
24 | |
18 | |
17 | |
14 |
User | Count |
---|---|
91 | |
86 | |
39 | |
25 | |
21 |