The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Everyone, I need your help again. I am struggling with creating a measure to rank manufacturers withing a category. I am attaching the sample data and desired result, as well as data model screenshot.
"OOW / Direct" is a calculated column in the table "DATA". "Manufacturer" is a column in another table. As you can see below the context is changed by two filters - "Month" and "CC ID".
Any ideas?
Solved! Go to Solution.
Can you use ISFILTERED?
Ranking = VAR OOW_DIR = VALUES ( Data[OOW / DIR] ) RETURN IF ( NOT ISBLANK ( [Sales Amount] ), IF ( ISFILTERED ( MANUFACTURER[MFGRID] ), CALCULATE( RANKX ( ALLSELECTED ( MANUFACTURER ), [Sales Amount] ), OOW_DIR ) ) )
Hello @Anonymous
I uploaded my sample .pbix file here for you to look at. MFR_Ranking.pbix
Give this measure a try:
Ranking = VAR OOW_DIR = VALUES ( Data[OOW / DIR] ) RETURN IF ( NOT ISBLANK ( [Sales Amount] ), IF ( ISINSCOPE ( MANUFACTURER[MFGRID] ), CALCULATE( RANKX ( ALLSELECTED ( MANUFACTURER ), [Sales Amount] ), OOW_DIR ) ) )
Thank you for such a quick reply.
Any chance to re-write the measure without using "ISINSCOPE" function?
I am limited to an older version of Power BI / DAX 😞
Long story
Can you use ISFILTERED?
Ranking = VAR OOW_DIR = VALUES ( Data[OOW / DIR] ) RETURN IF ( NOT ISBLANK ( [Sales Amount] ), IF ( ISFILTERED ( MANUFACTURER[MFGRID] ), CALCULATE( RANKX ( ALLSELECTED ( MANUFACTURER ), [Sales Amount] ), OOW_DIR ) ) )
Yes, it works like a charm.
I checked the first solution at home too with an updated version of Power BI --> works!
Thank you again.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
78 | |
77 | |
43 | |
39 |
User | Count |
---|---|
150 | |
116 | |
66 | |
64 | |
55 |