The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now
I have a measure with 3 text responses: A,B,C. I want to calculated some percentages and rates, such as A/C, A/(A+B+C), etc.
I tried getting count values of all these responses then using those but it did not work, here is what I attempted:
A Count = IF('Data'[Measure]="A"1,0)
B Count = IF('Data'[Measure]="B"1,0)
C Count = IF('Data'[Measure]="C"1,0)
When trying to simply calulate rates as so:
A rate = SUM('Data'[A Count])/(SUM('Data'[A Count])+SUM('Data'[B Count])+SUM('Data'[C Count]))
It will not let me reference my calculated fields for A,B,C count. This seems like a very simple calculation I am just fundamentally missing something.
I also need to calculate some rates between this first measure and another IE: Measure 2 with responses (1,2,3):
[A Count] / [2 Count], etc
Any thoughts?
Solved! Go to Solution.
Hi @trevordunham ,
I created some data:
Here are the steps you can follow:
1. Create measure.
A/C =
DIVIDE(
SUMX(ALL(Data),[A Count]) , SUMX(ALL(Data),[C Count]))
A/(A+B+C) =
DIVIDE(
SUMX(ALL(Data),[A Count]) , SUMX(ALL(Data),[A Count]) + SUMX(ALL(Data),[B Count]) +SUMX(ALL(Data),[C Count]))
A rate =
SUMX(ALL(Data),'Data'[A Count])/SUMX(ALL(Data),'Data'[A Count])+SUMX(ALL(Data),'Data'[B Count])+SUMX(ALL(Data),'Data'[C Count])
2. Result:
If I have misunderstood your meaning, please provide your desired output and your pbix file without privacy information.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @trevordunham ,
I created some data:
Here are the steps you can follow:
1. Create measure.
A/C =
DIVIDE(
SUMX(ALL(Data),[A Count]) , SUMX(ALL(Data),[C Count]))
A/(A+B+C) =
DIVIDE(
SUMX(ALL(Data),[A Count]) , SUMX(ALL(Data),[A Count]) + SUMX(ALL(Data),[B Count]) +SUMX(ALL(Data),[C Count]))
A rate =
SUMX(ALL(Data),'Data'[A Count])/SUMX(ALL(Data),'Data'[A Count])+SUMX(ALL(Data),'Data'[B Count])+SUMX(ALL(Data),'Data'[C Count])
2. Result:
If I have misunderstood your meaning, please provide your desired output and your pbix file without privacy information.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
It may sound simple but it is in fact rather complex. You will have to throw away your original measures and design completely new measures from scratch, based on the logic for the individual comparisons. Likely includes SUMX as well etc.
Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Avoid posting screenshots of your source data if possible.
Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.
Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.
User | Count |
---|---|
158 | |
109 | |
96 | |
83 | |
75 |
User | Count |
---|---|
154 | |
137 | |
131 | |
81 | |
62 |