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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Top N Visuals, Others need to mention as Others

Hi,

 

Below is the sample data, Need to create Bar chart with TOP N Condition as DAX.

 

DateWeekSalesCountry
22-08-202235400Ind
29-08-202236365Aus
05-09-202237876US
12-09-202238356UK
19-09-202239234China
26-09-202240555MEA
03-10-202241322Ind
10-10-202242373Aus
17-10-202243355US
24-10-202244338UK
31-10-202245320China
07-11-202246302MEA
14-11-202247285Ind
21-11-202248267Aus
28-11-202249249US
05-12-202250231UK

 

where X-Axis =Last 4 Week,Y-Axis = Sum of Sales,Legend = Country (Other than Top 3, other category need to mention as Others)

But the condition is 

Need to create DAX that show Top 3 Country with respect to sales and Date. All other countries need to mention as Others.

Example : 

 

 Wk-47Wk-48Wk-49Wk-50TOPN
Aus123120129543915
Ind11113212344410
UK908099100369
Others3214321236521528

 

Thank you,

@Uspace87 

@amitchandak 

@Greg_Deckler 

@lbendlin 

 

 

3 REPLIES 3
lbendlin
Super User
Super User

your example doesn't match your source data.

As @TomasAndersson pointed out: A general rule – Anything that is displayed on the x-axis of a chart needs to be physically present as a column of a table.   That also applies to matrix visuals.  You cannot use a measure to influence a column.  Here is a recipe to precompute the options:

Power BI – Dynamic TopN + Others with Drill-Down – Gerhard Brueckl on BI & Data (gbrueckl.at)

 

see attached

TomasAndersson
Solution Sage
Solution Sage

Hi!
I've used this guide to do similar things, maybe this can help you too: Display Top N items and Others in Power BI - Goodly

Anonymous
Not applicable

Hi TomasAndersson,

Thanks for replying!

This works only with Category.If i drag and drop date field its not working.

I need calculation that needs to work with Date and Category axis together.

 

Thank you,

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.