Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I'm currently working on creating a matrix that displays the top 5 customers based on Margin %, but I'm encountering a challenge. I want to include only those customers who have 5 or more units. Unfortunately, the current setup isn't populating the field with any information.
I suspect the issue arises because the top 5 customers by Margin % in the entire dataset have fewer than 5 units. Ideally, I would like to narrow down the population, filtering it to include only customers with 5 or more units, and then determine the top 5 based on Margin % within that subset.
Has anyone encountered a similar situation or have suggestions on how to address this?
Thanks in advance for your help!
Solved! Go to Solution.
You can use your units measure as a filter on your TOPN like this.
Top 5 Margin % =
CALCULATE (
[Margin %],
KEEPFILTERS (
TOPN (
5,
FILTER ( ALL ( Customer[CustomerKey] ), [Units] > 5 ),
[Margin %]
)
)
)
You can use your units measure as a filter on your TOPN like this.
Top 5 Margin % =
CALCULATE (
[Margin %],
KEEPFILTERS (
TOPN (
5,
FILTER ( ALL ( Customer[CustomerKey] ), [Units] > 5 ),
[Margin %]
)
)
)
Can I also use this for bottom 5?
Yep, you just need to change the sort order, like this.
Bottom 5 Margin % =
CALCULATE (
[Margin %],
KEEPFILTERS (
TOPN (
5,
FILTER ( ALL ( Customer[CustomerKey] ), [Units] > 5 ),
[Margin %],
ASC
)
)
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |