Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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 |
---|---|
57 | |
48 | |
18 | |
16 | |
15 |
User | Count |
---|---|
116 | |
42 | |
41 | |
28 | |
21 |