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
Hello,
Need some immediate assistance on this issue am facing. So, I have a Category Line Grouping table that looks like this:
Basically Line Name is the PK and it could belong to any of the different categories. Each Line Name on the Excel is a measure that is then consolidated and used on a matrix.
I've all the measures for each Line Item ready and if I display each Line Item along with the consolidated summary measure, it works fine and looks like this.
The problem occurs when I group these under their respective Category (I included both Category and Line Name on the columns). This is what it looks then when collapsed. As you can see for Volume and Net Revenue which have only one Line Name, the Summary displays the right number but for VILC/Unit and Total VILC which have 2 different line names the Summary column appears blank. I would expect the sum of VIC & VLC to appear under Total VILC. For VILC/Unit I would expect the sum of VIC/Unit and VLC/Unit.
When I expand the Total VILC and VILC/Unit though I see both the respective Line names. Its just that when I collapse it I don't see the sum showing up on the Category which I what I expect to see.
Is this expected behaviour of Power BI? Or is there something wrong or something else I need to do to fix this?
Would appreciate any help on this. Please let me know if you need more information!
Thank you.
Solved! Go to Solution.
Hey @Koushikrish,
At first glance, it looks like your SWITCH measure doesn't contemplate the scenario where it should calculate the top level category.
I would suggest adding conditions to contemplate that, like:
VAR LineName = SELECTEDVALUE( 'dimCategory'[Line Name] )
VAR Category = SELECTEDVALUE( 'dimCategory'[Category] )
RETURN
SWITCH(
TRUE(),
// Level 2
LineName = "VOLUME", CALCULATE ( [Volume] ),
LineName = "NET REVENUE", CALCULATE ( [Net_Revenue] ),
LineName = "VIC", CALCULATE ( [VIC] ),
LineName = "VLC", CALCULATE ( [VLC] ),
LineName = "VIC/Unit", CALCULATE ( [VICPerUnit] ),
LineName = "VLC/Unit", CALCULATE ( [VLCPerUnit] ),
// Level 1
Category = "VOLUME", CALCULATE ( [Volume] ),
Category = "NET REVENUE", CALCULATE ( [Net_Revenue] ),
Category = "VILC/Unit", CALCULATE ( [VICPerUnit] + [VLCPerUnit] ),
Category = "Total VILC", CALCULATE ( [VIC] + [VLC] )
)
Hey @Koushikrish,
At first glance, it looks like your SWITCH measure doesn't contemplate the scenario where it should calculate the top level category.
I would suggest adding conditions to contemplate that, like:
VAR LineName = SELECTEDVALUE( 'dimCategory'[Line Name] )
VAR Category = SELECTEDVALUE( 'dimCategory'[Category] )
RETURN
SWITCH(
TRUE(),
// Level 2
LineName = "VOLUME", CALCULATE ( [Volume] ),
LineName = "NET REVENUE", CALCULATE ( [Net_Revenue] ),
LineName = "VIC", CALCULATE ( [VIC] ),
LineName = "VLC", CALCULATE ( [VLC] ),
LineName = "VIC/Unit", CALCULATE ( [VICPerUnit] ),
LineName = "VLC/Unit", CALCULATE ( [VLCPerUnit] ),
// Level 1
Category = "VOLUME", CALCULATE ( [Volume] ),
Category = "NET REVENUE", CALCULATE ( [Net_Revenue] ),
Category = "VILC/Unit", CALCULATE ( [VICPerUnit] + [VLCPerUnit] ),
Category = "Total VILC", CALCULATE ( [VIC] + [VLC] )
)
Hello @Greg_Deckler ,
This is my measure formula. Can't really post my PBIX here, sorry about that.
SWITCH
(
SELECTEDVALUE( 'dimCategory'[Line Name] ),
"VOLUME", CALCULATE ( [Volume] ),
"NET REVENUE", CALCULATE ( [Net_Revenue] ),
"VIC", CALCULATE ( [VIC] ),
"VLC", CALCULATE ( [VLC] ),
"VIC/Unit", CALCULATE ( [VICPerUnit] ),
"VLC/Unit", CALCULATE ( [VLCPerUnit] )
)
Thanks for your help.
@Koushikrish What is your measure formula? Can you post a link to your PBIX?
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 |
---|---|
108 | |
77 | |
76 | |
43 | |
37 |
User | Count |
---|---|
156 | |
109 | |
64 | |
60 | |
55 |