Forum Discussion
harmon-tuazon
2 years agoNew Member
TOPN Functions returns the same value as my COUNT aggregate function
Hey everyone. Sorry super new to posting. I have a measure that supposed to return the top 10 values of a table I'm working with (using Calculate and TopN). I have another measure that just aggregate...
- 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 )
Jihwan_Kim
Super User
2 years agoHi,
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 )