Forum Discussion
Syndicate_Admin
2 years agoAdministrator
TopN Problems Same result
Hello, I am making a dashboard with open data on Bullying in Peru and I want to make a top 10 of the subtypes of violence, it should be noted that they are string data, and use this dax:
Top10 = CALCULATE([Subtypes],TOPN(10,ALL('DM Facts'[SUBTIPO_VIOLENCIA]),[Subtypes],DESC),VALUES('Type of SubViolence'[SUBTIPO_VIOLENCIA]))
[Subtypes] is COUNTROWS('DM Facts')
However, it gives me all the same results
[Subtypes] is COUNTROWS('DM Facts')
However, it gives me all the same results
Why would all the top 10 get the same results? Thanks a lot.
The TOPN is changing the fitler context to override the line, try it with a KEEPFILTERS.
Top10 = CALCULATE ( [Subtypes], KEEPFILTERS ( TOPN ( 10, ALL ( 'DM Facts'[SUBTIPO_VIOLENCIA] ), [Subtypes], DESC ) ) )
4 Replies
- jdbuchanan71Super User
The TOPN is changing the fitler context to override the line, try it with a KEEPFILTERS.
Top10 = CALCULATE ( [Subtypes], KEEPFILTERS ( TOPN ( 10, ALL ( 'DM Facts'[SUBTIPO_VIOLENCIA] ), [Subtypes], DESC ) ) )- Syndicate_AdminAdministrator
Indeed this is the solution, thank you very much.
- Ashish_MathurSuper User
Hi,
Share the download link of the PBI file.
- Syndicate_AdminAdministrator
I didn't know I had to share the download link.