Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi,
Below is the sample data, Need to create Bar chart with TOP N Condition as DAX.
| Date | Week | Sales | Country |
| 22-08-2022 | 35 | 400 | Ind |
| 29-08-2022 | 36 | 365 | Aus |
| 05-09-2022 | 37 | 876 | US |
| 12-09-2022 | 38 | 356 | UK |
| 19-09-2022 | 39 | 234 | China |
| 26-09-2022 | 40 | 555 | MEA |
| 03-10-2022 | 41 | 322 | Ind |
| 10-10-2022 | 42 | 373 | Aus |
| 17-10-2022 | 43 | 355 | US |
| 24-10-2022 | 44 | 338 | UK |
| 31-10-2022 | 45 | 320 | China |
| 07-11-2022 | 46 | 302 | MEA |
| 14-11-2022 | 47 | 285 | Ind |
| 21-11-2022 | 48 | 267 | Aus |
| 28-11-2022 | 49 | 249 | US |
| 05-12-2022 | 50 | 231 | UK |
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-47 | Wk-48 | Wk-49 | Wk-50 | TOPN | |
| Aus | 123 | 120 | 129 | 543 | 915 |
| Ind | 111 | 132 | 123 | 44 | 410 |
| UK | 90 | 80 | 99 | 100 | 369 |
| Others | 321 | 432 | 123 | 652 | 1528 |
Thank you,
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
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
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,
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 21 | |
| 20 | |
| 18 | |
| 13 |
| User | Count |
|---|---|
| 58 | |
| 50 | |
| 38 | |
| 31 | |
| 27 |