Forum Discussion
Topn with additonal filter
- Anonymous5 years ago
Hi MichalDe ,
Got it. I have reached your expected in two ways please check.
- Method 1:
1. Create a table:
Sum top10 table = SUMMARIZE('Date',"Top10", SUMX(TOPN(10, ALL(Customer[Full Name]),[Total Sales],DESC),[Total Sales]) )2. Create a measure:
Top 10 All Time = IF([Total Sales]=BLANK(),BLANK(),MAX('Sum top10 table'[Top10]))- Method 2:
1.Create a new Year table:
New Table = SELECTCOLUMNS(FILTER('Date',[Total Sales]<>BLANK()),"Year",[Year])2.Create new total sales measure:
new total sales = CALCULATE([Total Sales],FILTER('Date',[Year]=MAX('New Table'[Year])))3. Top10:
new top10 = SUMX(TOPN(10,ALL(Customer[Full Name]),[Total Sales],DESC),[Total Sales])The final output is shown below:
In addition, when I open your pbix file, an alert dialog shown :
It seems that your PBI is in an earlier version, so please upgrade it to the latest version and have a try.
Download Microsoft Power BI Desktop from Official Microsoft Download Center
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi MichalDe ,
I used the data sample you provided, was it not your real data ?
Both measures below work fine on my side. Please try :
Top 10 All Time = IF( RANKX(ALL('Date'),[Total Sales],,DESC,Dense)<=10,[Total Sales])Top 10 All Time = CALCULATE([Total Sales],TOPN(10,ALL(Customer[Full Name]),[Total Sales],DESC),ALL('Date'[Year]))
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- MichalDe5 years agoFrequent Visitor
Hi Anonymous
Thank for your reply. Could you send me your screenshot with the table to see how it looks?In my file it still doesnt work. To be more precise I send the table preview that I would like to achieve. Does it look the same on your side?