Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello smart people,
I want to get the highest value (cycle time days) from the first two rows.
DAX that i tried:
Hi @Anonymous ,
Please try the DAX as followed:
CycleTime_MaxValueFirstTwoRows = CALCULATE(MAX('Test view'[CycleTime_MaxDays]),TOPN(2,'Test view'))
Hope it helps!
Best regards,
Community Support Team_ Joseph Ji
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
You can use the following DAX expression:
CycleTime_MaxValueFirstTwoRows =
CALCULATE(
MAX('Test view'[Cycle Time Days]),
TOPN(2, 'Test view', 'Test view'[CycleTime_MaxDays], DESC)
)
Here's a breakdown of the changes:
I replaced 'Test view'[CycleTime_MaxDays] with 'Test view'[Cycle Time Days] inside the MAX function because you want to find the maximum value for the 'Cycle Time Days' column.
I added DESC to the TOPN function to sort the rows in descending order based on the 'Cycle Time Days' column. This ensures that the top two rows will have the highest values.
With these adjustments, the expression should give you the maximum value of the 'Cycle Time Days' column for the first two rows in your 'Test view' table.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Thank you for your reply.
It seems like it gives the same output like MAX('Test view'[Cycle Time Days])
The same problem as before.
I see, thank you for providing feedback. Let's try a different approach to get the maximum value for the first two rows. You can use the FILTER function to filter the table and then calculate the maximum. Here's an alternative DAX formula:
CycleTime_MaxValueFirstTwoRows =
CALCULATE(
MAX('Test view'[CycleTime_MaxDays]),
FILTER(
TOPN(2, 'Test view', 'Test view'[YourSortingColumn]),
'Test view'[CycleTime_MaxDays] = MAX('Test view'[CycleTime_MaxDays])
)
)
In this formula:
This formula first uses TOPN to get the top two rows based on the specified sorting column and then filters those rows where 'CycleTime_MaxDays' is equal to the maximum value of 'CycleTime_MaxDays' in the entire table. Finally, it calculates the maximum value within this filtered subset.
Give this formula a try and see if it provides the desired result.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.