Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Ania26
Helper III
Helper III

TOP N

I would like to have stucked column chart where I show top 3 countries plus Others per year.  Those top 3 countries must be selected among all years and be the same every year so in this case it will be Comoros,Turkmenistan,Liberia. Those 3 countries I would like to show on he chart per year and remaining countires as Others. Then I would like to have it sorted , Others at the top. 
Year Region Country Value
2013 Americas Caribbean Other 1
2013 Americas Paraguay 2
2014 Americas Congo 3
2013 Americas DEM. REP. OF CONGO 2
2013 Americas Equatorial Guinea 3
2014 Americas Eritrea 4
2013 Americas Kyrgyzstan 4
2013 Americas Lesotho 3
2013 Americas Liberia 22
2014 Americas Malawi 1
2013 Americas Maldives 2
2013 Europe Bosnia And Herzegovina 3
2013 Europe Botswana 2
2013 Europe Burundi 3
2014 Europe Cape Verde 4
2013 Europe Car Central Af. Rep 4
2013 Europe Chad 3
2014 Europe Comoros 22
2013 SSEA-CIS-MEA Mayotte 1
2013 SSEA-CIS-MEA Namibia 2
2013 SSEA-CIS-MEA Other South Pacific 3
2013 SSEA-CIS-MEA Reunion 2
2013 SSEA-CIS-MEA Seychelles 3
2013 SSEA-CIS-MEA Sri Lanka 4
2014 SSEA-CIS-MEA Swaziland 4
2014 SSEA-CIS-MEA Turkish Cyprus 3
2013 SSEA-CIS-MEA Turkmenistan 22
2014 SSEA-CIS-MEA Zimbabwe 1
2013 SSEA-CIS-MEA Tajikistan 2
2013 SSEA-CIS-MEA Bahrain 3
2013 SSEA-CIS-MEA Uganda 4

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Ania26 . First create a measure 

All Time = calculate([You measure], all('Date')) // Assuming you are using Date table   

 

or

 

All Time = calculate([You measure], all('Table'[Date]))
Then you can use TOPN or Window

 

example 

M1= calculate([All Time], keepfilters(topn(3, allselected(Geo[Country]), [All Time], desc) )

Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Ania26 . First create a measure 

All Time = calculate([You measure], all('Date')) // Assuming you are using Date table   

 

or

 

All Time = calculate([You measure], all('Table'[Date]))
Then you can use TOPN or Window

 

example 

M1= calculate([All Time], keepfilters(topn(3, allselected(Geo[Country]), [All Time], desc) )

Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.