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
ChrisB1977
Frequent Visitor

Calculating Percentage by filtering by another measure

Hi,

 

I’m trying to create a percentage in PowerBI. I have the following 2 columns in my table:

 

Views

Targeted

25000

0

25000

0

50000

1

 

I want to show on a card visual the % of Views that are targeted – so, expressing the fact that 50000 of the Views are marked with a 1 from the Targeted column = 50% of total views. Sorry, may be very simple, but how should I do this?

 

Many thanks

 

Chris

2 ACCEPTED SOLUTIONS
quentin_vigne
Solution Sage
Solution Sage

Hi @ChrisB1977

 

My idea would be to create a new column with this formula :

 

Result = IF(Table1[Targeted]=1;DIVIDE(Table1[Views ];SUM(Table1[Views ]));0)

Replace Table1 by your Table name

And in the modelisation section click on the % image to change your 0.5 into 50%

And If you numbers are text add "   " for the 1

 

Not sure that's the best thing but it works for me

View solution in original post

probably it's different locale try replacing ; with ,



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

5 REPLIES 5
quentin_vigne
Solution Sage
Solution Sage

Hi @ChrisB1977

 

My idea would be to create a new column with this formula :

 

Result = IF(Table1[Targeted]=1;DIVIDE(Table1[Views ];SUM(Table1[Views ]));0)

Replace Table1 by your Table name

And in the modelisation section click on the % image to change your 0.5 into 50%

And If you numbers are text add "   " for the 1

 

Not sure that's the best thing but it works for me

Hi @quentin_vigne,

 

Thanks very much for replying so quickly. I tried the below but keep getting an error stating 'The Syntax for ';' is incorrect' - any ideas why it's doing this?

 

Many thanks for your help

 

Chris

probably it's different locale try replacing ; with ,



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thank you @quentin_vigne and @Stachu, a combination of your suggestions worked! Rerally appreciate your help

help.PNG

It works when I copy your datas on my PBI version

Did you change the table name / column name so that it match yours ?

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.