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

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

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
March Fabric Community Update

Fabric Community Update - March 2024

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

Fabric Community Conference

Microsoft Fabric Community Conference

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.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.