This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
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,
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 32 | |
| 25 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 66 | |
| 36 | |
| 32 | |
| 25 | |
| 23 |