Forum Discussion
Determine topN
- 2 years ago
elizabethvieira , Try using below DAX
Top5Areas =
TOPN(
5,
SUMMARIZE(
'impact (2)',
'impact (2)'[area],
"Total Articles", COUNT('impact (2)'[UT])
),
[Total Articles],
DESC
) - 2 years ago
Let's try different approach
First create a measure
PublicationCount = COUNT(TableName[UT])Then create a new table by going to modelling tabTopAreas =TOPN(5,SUMMARIZE(TableName,TableName[Area],"PublicationCount", [PublicationCount]),[PublicationCount],DESC)elizabethvieira , Did you tried to make table or measure? - 2 years ago
hello elizabethvieira
the TOPN from your link looks fine. I tried making an example and the result is good.
Left one is total sum and right one is sum of top 5 (exclude E and G as the lowest 2).
also, if you want to show sum of top 5 in pie chart, you can do easier in visual filter as there is no calculation.
before visual filter
after visual filter (put your areas in Legend and your value in Values, then your value again in By Value in visual filter option). in here, change from SUM to COUNT if you want to have count result.
Hope this will help.
Thank you.
- Anonymous2 years ago
Thanks to Irwan and bhanu_gautam for the quick reply and solution. The link you provided to the pbix file has privacy I can't open it. Here is my test data:
(1) We can create measures.
Count = COUNT('impact (2)'[UT])Index = var _table=SUMMARIZE(ALLSELECTED('impact (2)'),[area],"count",[Count]) RETURN RANKX(_table,[count],,DESC)(2) We can create tables.
TopAreas = TOPN( 5, SUMMARIZE( 'impact (2)', 'impact (2)'[area], "PublicationCount", [Count] ), [PublicationCount], DESC )TopAreas2 = var _table=SUMMARIZE('impact (2)',[area],"count",[Count],"index",[Index]) RETURN SELECTCOLUMNS(FILTER(_table,[index]<=5),[area],[count])Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks to Irwan and bhanu_gautam for the quick reply and solution. The link you provided to the pbix file has privacy I can't open it. Here is my test data:
(1) We can create measures.
Count = COUNT('impact (2)'[UT])Index =
var _table=SUMMARIZE(ALLSELECTED('impact (2)'),[area],"count",[Count])
RETURN RANKX(_table,[count],,DESC)
(2) We can create tables.
TopAreas =
TOPN(
5,
SUMMARIZE(
'impact (2)',
'impact (2)'[area],
"PublicationCount", [Count]
),
[PublicationCount],
DESC
)
TopAreas2 =
var _table=SUMMARIZE('impact (2)',[area],"count",[Count],"index",[Index])
RETURN SELECTCOLUMNS(FILTER(_table,[index]<=5),[area],[count])
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Many thanks to all.
I fixed my issues. It is now working well.
Best,
Elizabeth