Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
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,
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 42 | |
| 41 | |
| 21 | |
| 21 |
| User | Count |
|---|---|
| 150 | |
| 107 | |
| 64 | |
| 36 | |
| 36 |