Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all,
This is a very dynamic use case in which we need to provide dynamic top n functionaility by a field parameter. There is also an uneven client hierarchy in a matrix visual (used Parent-child hierarchies – DAX Patterns to remove blanks from the uneven hierarchy).
The top n selection needs to filter the matrix visual based on the highest level in the hierarchy. Meaning, if Top 3 by KPI1 is selected, it should display 3 clients (on the highest level in hierarchy) + their children nodes (any number of children levels they may have) sorted in the matrix by KPI 1. The rest of the KPIs in the matrix will display based on the selected KPI 1. The total for the KPIs would change based on the Top n selection. Here is the final required output.
Note: The highest level will have its own KPI values too. This means that, for example, the sub total will aggregate KPI 1 for Client 1 (inclusive), A, B, C, and D.
Also, we got the above working functionality-wise using the TOPN() dax. However, when checking the data, it is noticed that with the TOPN(), only the positive values are displayed for the KPIs, it removes the negative values from the matrix. This gives a distored view of the insight about the data. To fix this, tried using RANKX(), RANK() and the WINDOW() funtion but with partial success. As this is approaching the deadline to deliver, any immediate help would be highly appreciated.
Thanks
P.S. Below are the DAX measures that are tried already.
------------------------------------------------------------
------------------------------------------------------------
-------------------------------------------------------------
KPI 1 =
Hi @Anonymous I am unsure if I can share via onedrive. Would you know if there is a secure link through which I could upload the sample file?
Secondly, I have found out that the TOPN() works fine in my case. The only observation for TOPN() is that it displays the positive values first and then the zeroes and then the blanks and then the negatives.
To remove the blanks, I have modified the above KPI 1 calculation that uses TOPN() as follows. It works fine in the collapsed mode (of the matrix visual), however when expand the hierarchy, it shows random client[Level1] in addition to the top N client[Level1].
Hi @sbatool ,
Could you please provide a simplified .pbix file that includes a subset of the data, visual, and any other relevant elements where you are encountering issues? Additionally, please provide a clear explanation of the specific problem you are facing and the desired outcome you wish to achieve based on the provided data. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
9 | |
8 |