cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerEnthusiast
Helper I
Helper I

Calculate percentage of 100 for each category

Hi there.

I have a Power BI report where I would like to calculate the Percentage of 100 for each of the options against the category values (the 'Yes' and 'No' options) identified in the image below.

For example, calculate the percentage out of 100 for Option 1; calculate the percentage out of 100 for Option 2 ect...

PowerEnthusiast_0-1605023239539.png

Any help on this would be appreciated.

Thank you.

1 ACCEPTED SOLUTION
edhans
Super User
Super User

@PowerEnthusiast - this measure works. All it effectively does is puts a % value on your data.

Values = 
VAR varNumerator = SUM('Table'[Value])
RETURN
    DIVIDE(
        varNumerator,
        100
    )

So 18 for option 1 become 18% as an example. If that isn't what you need, please explain what you are expecting the output to be.

edhans_0-1605026306314.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

8 REPLIES 8
edhans
Super User
Super User

@PowerEnthusiast - this measure works. All it effectively does is puts a % value on your data.

Values = 
VAR varNumerator = SUM('Table'[Value])
RETURN
    DIVIDE(
        varNumerator,
        100
    )

So 18 for option 1 become 18% as an example. If that isn't what you need, please explain what you are expecting the output to be.

edhans_0-1605026306314.png

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
edhans
Super User
Super User

We would need data (see links below) to really help @PowerEnthusiast , but something along the lines of this would work for the No values, and a similar measure would work for Yes values.

 

Measure =
VAR varNumerator =
    SUMX(
        FILTER(
            Table,
            Table[Field] = "No"
        ),
        Table[Value]
    )
RETURN
    DIVIDE(
        varNumerator,
        100
    )

 

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans 

Thank you for the response.

The table looks like this:

PowerEnthusiast_0-1605023885612.png

Where there is an 'Options' table used for the x-axis.

Also, getting the percentages to visualise on a stacked chart - as shown in the initial image, would be ideal 🙂

Again @PowerEnthusiast - please see the links below for providing data. I'm not rekeying that in. Thanks!

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

OptionsValueLegend

Option 28Yes
Option 49Yes
Option 69No
Option 56No
Option 17Yes
Option 63Yes
Option 49No
Option 34Yes
Option 27Yes
Option 510Yes
Option 61No
Option 26Yes
Option 38No
Option 44Yes
Option 210Yes
Option 21Yes
Option 47No
Option 32No
Option 13Yes
Option 25No
Option 69Yes
Option 67Yes
Option 18Yes
Option 67Yes
Option 49No
Option 43Yes
Option 56No
Option 45No
Option 38Yes

@edhans 

This is the only way I could upload a sample set of the data.

Got it @PowerEnthusiast - let me play with it. 👍



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans 

Trying to add the table, but it's not allowing me to.

PowerEnthusiast_0-1605025254888.png

 

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors