Forum Discussion
TOPN Functions returns the same value as my COUNT aggregate function
- 2 years ago
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file whether it suits your requirement.
Sales: = SUM(data[sales])% top 3 sales: = VAR _allsales = CALCULATE ( [Sales:], ALL ( data[category] ) ) VAR _topsales = CALCULATE ( [Sales:], TOPN ( 3, ALL ( data[category] ), [Sales:], DESC ) ) RETURN DIVIDE ( _topsales, _allsales )
Thanks for the reply from Jihwan_Kim.
Hi harmon-tuazon ,
Here I have another idea in mind, and I would like to share it for reference.Sample data is as follows:
1.Create two measure:
#Meal Kits = COUNT(financials[Index])
#Top 10 Meal Kits Ordered =
VAR _p =
SELECTEDVALUE ( financials[Product] )
RETURN
MAXX (
FILTER (
TOPN (
3,
SUMMARIZE (
ALLSELECTED ( financials ),
'financials'[Product],
"Top",
CALCULATE (
COUNT ( 'financials'[Index] ),
ALLEXCEPT ( financials, financials[Product] )
)
),
[Top], DESC
),
'financials'[Product] = _p
),
[Top]
)
2.The top three product totals were successfully obtained using the measure just created.
Best Regards,
Zhu
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!