Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a matrix table, i used a measure column using Swtich function to get some data.
i used a measure column to get W/L ration as below:
Solved! Go to Solution.
The problem here is that SELECTEDVALUE() will return a value if there is a single value for Closed[Outcome] and at the "Total" level you don't have a single value (you technically have all values).
So I think changing the code to something like the following (using a variable to avoid copying the calculation logic twice) should fix this for you.
Ratio = VAR _pcntWon = ( DIVIDE ( CALCULATE ( COUNT ( Closed[Outcome] ), Closed[Outcome] = "1. Won" ), ( CALCULATE ( COUNT ( Closed[Outcome] ), Closed[Outcome] = "1. Won" ) + CALCULATE ( COUNT ( Closed[Outcome] ), Closed[Outcome] = "2. Lost" ) ), 0 ) * 100 RETURN SWITCH ( SELECTEDVALUE ( closed[Outcome], "Total" ), "1. Won", _pcntWon, "Total", _pcntWon, " " )
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Hi Greg,
Thank you for your reply. i go througth the links you sent, but there are some rows sholud be Balnk and i will have same issue. Please what shall i write in the measure column to solve the issue.
Thank you Again.
Nad
HI @nsaleh,
If you can please share a pbix file with part of sample data for test. It should be help for testing and coding formula.
BTW, I'm not so recommend you to use switch function to handle with summarize records. It not suitable for split summarize records to multiple part.
Regards,
Xiaoxin Sheng
The problem here is that SELECTEDVALUE() will return a value if there is a single value for Closed[Outcome] and at the "Total" level you don't have a single value (you technically have all values).
So I think changing the code to something like the following (using a variable to avoid copying the calculation logic twice) should fix this for you.
Ratio = VAR _pcntWon = ( DIVIDE ( CALCULATE ( COUNT ( Closed[Outcome] ), Closed[Outcome] = "1. Won" ), ( CALCULATE ( COUNT ( Closed[Outcome] ), Closed[Outcome] = "1. Won" ) + CALCULATE ( COUNT ( Closed[Outcome] ), Closed[Outcome] = "2. Lost" ) ), 0 ) * 100 RETURN SWITCH ( SELECTEDVALUE ( closed[Outcome], "Total" ), "1. Won", _pcntWon, "Total", _pcntWon, " " )
Hi
Its working fine now. Thank you so much for your help.
Nad
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |