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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
aflintdepm
Helper III
Helper III

Column Graph for percentages, not counts

I'm sure I'm missing something obvious, but I just can't figure it out.

 

My company wants to visualize scores on an audit.  The score is a percentage, just like a grade a test.  The score is calculated as:
#Yes/(#Yes + #No)

 

So, 20 yes, 10 no would be

20/(20+10)= 66%

 

When I try to visualize this, I can only get a 1 because the column graph wants to do a Count of Total.

 

What am I missing??

1 ACCEPTED SOLUTION
aflintdepm
Helper III
Helper III

Ok, so I found a solution.

First, I went back to my query and realized that the total column was giving me "NaN" when the denominator was 0.  To resolve this, I updated the formula for this column to 

= if ([Yes]+[No]=0) then 0 else ([Yes]/([Yes]+[No]))

This resolved the NaN issue and gave me all numbers

Next, I changed the column type to Percentage

After reloading the queary, the visualization returned the expected results, despite indicating that it was still summing the values.

aflintdepm_0-1666834291472.png

I did find one limitation.  Because I have mulitiple locations for this data, I only get these "clean" results when I am filtered for a single location.  If I try to combine the scores across locations, I get all of the locations added together.  This makes sense, so I changed the function to Average and that resolved the problem.  Reverting to a single location still returned the correct values for that individual location.

View solution in original post

7 REPLIES 7
aflintdepm
Helper III
Helper III

Ok, so I found a solution.

First, I went back to my query and realized that the total column was giving me "NaN" when the denominator was 0.  To resolve this, I updated the formula for this column to 

= if ([Yes]+[No]=0) then 0 else ([Yes]/([Yes]+[No]))

This resolved the NaN issue and gave me all numbers

Next, I changed the column type to Percentage

After reloading the queary, the visualization returned the expected results, despite indicating that it was still summing the values.

aflintdepm_0-1666834291472.png

I did find one limitation.  Because I have mulitiple locations for this data, I only get these "clean" results when I am filtered for a single location.  If I try to combine the scores across locations, I get all of the locations added together.  This makes sense, so I changed the function to Average and that resolved the problem.  Reverting to a single location still returned the correct values for that individual location.

aflintdepm
Helper III
Helper III

Thank you everyone for the responses.

 

First, the data is in 3 columns

Yes  -  No  -  N/A

aflintdepm_0-1666787556773.png

The "Total Score" column is a calculated column that I added in Power Query

 

My desired output would be something like this (from existing Excel)

aflintdepm_1-1666787724067.png

 

 

Arul
Super User
Super User

@aflintdepm ,

Can you share the sample data or smaple output screenshot?

Thanks,





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


@aflintdepm ,

try this measure,

 

Score% = 
DIVIDE(MAX('Yes/No'[Yes]),SUMX('Yes/No','Yes/No'[Yes]+'Yes/No'[No]))

 

Arul_1-1666759011702.png

Thanks,





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Thennarasu_R
Responsive Resident
Responsive Resident

Hi Anna,
Here you using max .It consider only Maximum Value in Column or Consider sum of Total value 😊😍

@Thennarasu_R ,

For the above, we need max of that particular context if it is having one row like the above (For eg: A is having one row and we are considering MAX of that context) and summing up two column values of that row for both yes and no, so it will work in this scenario.

Thanks,





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Thennarasu_R
Responsive Resident
Responsive Resident

@Arul 
Ok Thanks 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.