Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Hi everyone,
I would like to calculate the average value of top two values for every section per year&month,
I have tried ranking them first, but I couldn't have a correct ranking.
Do you guys have an idea of how to do it?
Solved! Go to Solution.
Hi @nqahman
Try this MEASURE
Measure = AVERAGEX ( TOPN ( 2, FILTER ( ALL ( TableName ), TableName[YEAR] = SELECTEDVALUE ( TableName[YEAR] ) && TableName[MONTH] = SELECTEDVALUE ( TableName[MONTH] ) && TableName[Section] = SELECTEDVALUE ( TableName[Section] ) ), TableName[VALUE], DESC ), CALCULATE ( SUM ( TableName[VALUE] ) ) )
Hi @nqahman
Try this MEASURE
Measure = AVERAGEX ( TOPN ( 2, FILTER ( ALL ( TableName ), TableName[YEAR] = SELECTEDVALUE ( TableName[YEAR] ) && TableName[MONTH] = SELECTEDVALUE ( TableName[MONTH] ) && TableName[Section] = SELECTEDVALUE ( TableName[Section] ) ), TableName[VALUE], DESC ), CALCULATE ( SUM ( TableName[VALUE] ) ) )
Thank you @Zubair_Muhammad for your response,
An error exists because of too many arguments in the FILTER function.
The maximum number is 2 arguments: Table name and one expression.
I have only 2 arguments in above formula for FILTER
1)
ALL ( TableName )
2)
TableName[YEAR] = SELECTEDVALUE ( TableName[YEAR] ) && TableName[MONTH] = SELECTEDVALUE ( TableName[MONTH] ) && TableName[Section] = SELECTEDVALUE ( TableName[Section] )
Check out the May 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
74 | |
72 | |
71 | |
50 | |
45 |
User | Count |
---|---|
46 | |
38 | |
29 | |
28 | |
28 |