Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
trevordunham
Helper III
Helper III

Percentage of a measure

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?

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @trevordunham ,

I created some data:

vyangliumsft_0-1646029198873.png

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:

vyangliumsft_1-1646029198875.png

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

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @trevordunham ,

I created some data:

vyangliumsft_0-1646029198873.png

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:

vyangliumsft_1-1646029198875.png

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

lbendlin
Super User
Super User

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.