Forum Discussion
Nested (3 levels) TOPN using Power BI DAX not working for categories but working for other
- 2 years ago
Hi TFRec
lbendlin already provided a very good approach, but still, if you seeking another way of doing that you can check this video this is not exact but with some modification this might help you to attain solution: https://youtu.be/cs2AwJljBrQ?si=yQR7T5WZZMfTaSDh
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem
Regards
You need to take extra care to use separate calculations for each category.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
Hello lbendlin ,
Thank you for the help. I have uploaded a pbix using publicly available trade data to replicate the issue at https://we.tl/t-KFNe32hvK9? (hope it is all right to give a WeTransfer link, it was mentioned on the upload data link as one of the ok mediums).
You will see there that for code "27090090" under partner country "NL" it only shows "BE" and "DE", but it should also show "ES" as they are the third biggest declarant country with 191 Million EUR for the code and partner country in question.
Edit: I initially accidentally replied to topic first.
- lbendlin2 years ago
Super User
on the top two levels do you want to show the total level value or only the value contributed by the underlying top 3?
- TFRec2 years agoFrequent Visitor
Hello lbendlin ,
Thank you very much for having taken the time to look into this. Looking to have the value contributed by the underlying top 3, as it is working in your approach. Am however struggling to change the formula in such a way that it still does the top 3 for the other two upper levels as well.- lbendlin2 years ago
Super User
You will have to create three calculated tables, either materialized or as part of the measure (there might be severe performance issues in the latter approach, especially with your amount of data). You need to start from the lowest level as I showed, and then need to use the result of that for the next level, and then the result of that for the top level.
Certainly doable but rather complex. Think about softening your requirement, or finding a graphical solution instead (like a decomposition tree)