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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
54 | |
26 | |
20 | |
15 | |
11 |
User | Count |
---|---|
77 | |
62 | |
44 | |
17 | |
12 |