March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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 @v-yiruan-msft 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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
7 |
User | Count |
---|---|
37 | |
32 | |
16 | |
16 | |
12 |