cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kjartank Regular Visitor
Regular Visitor

Calculating percentage

Hi

 

I have a problem finding out how to get these percentages to work properly. I have one column with numbers and blanks. What I want to do with it is to calculate how many of the filled values are greater than 0. The easiest way would be to switch everything greater than 0 into "Yes" and everything that is labelled 0 into "No", leaving out all the blanks, so I can put it in a bar chart, counting the percentage of yes and no.

 

The data looks like this.

 

How_many_0-5
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0






0
0
0
1
0
0
0
2
2
0

0













0
0

0
0
0
0
0
0
0
0
0
0
0
0
0
1
0

0
0
0
0
0
0
0

Thanks in advance! 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
giblet17 Member
Member

Re: Calculating percentage

Hi,

 

You could create a calculated column which does exactly what you said:

 

Converted = IF( ISBLANK( Table[How_many_0-5] ), BLANK(), IF( Table[How_many_0-5] = 0, "No", "Yes"))

Then you can create a measure:


Count = COUNTA( Table[Converted] )

 

Or as a percentage:

 

Perc = COUNTA( Table[Converted] ) / Calculate( COUNTA(Table[Converted]), ALL(Table[Converted]) )

 

and make a bar chart of the converted column with values coming from one of the measures.

 

You may need to filter out the blank column from the visual if you don't want to see it on the bar chart. Unsure off the top of my head.

 

Hope this helps,

 

Will

View solution in original post

3 REPLIES 3
Highlighted
giblet17 Member
Member

Re: Calculating percentage

Hi,

 

You could create a calculated column which does exactly what you said:

 

Converted = IF( ISBLANK( Table[How_many_0-5] ), BLANK(), IF( Table[How_many_0-5] = 0, "No", "Yes"))

Then you can create a measure:


Count = COUNTA( Table[Converted] )

 

Or as a percentage:

 

Perc = COUNTA( Table[Converted] ) / Calculate( COUNTA(Table[Converted]), ALL(Table[Converted]) )

 

and make a bar chart of the converted column with values coming from one of the measures.

 

You may need to filter out the blank column from the visual if you don't want to see it on the bar chart. Unsure off the top of my head.

 

Hope this helps,

 

Will

View solution in original post

kjartank Regular Visitor
Regular Visitor

Re: Calculating percentage

This is beautiful! Thanks a lot! 🙂

giblet17 Member
Member

Re: Calculating percentage

Fantsatic, glad I could help! 😄

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors
Users online (843)