Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
10 |
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
8 |