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
curiouspowerbi
New Member

Want to calculate percent of total by column value for a survey

Hi All,

I am relatively new to Power BI DAX formula.

I am working on a survey file which contains the below format. 

 

Response IDQ1Q2Q3Category
1FavorableUnfavorableNeutralFemale
2FavorableFavorableNeutralMale
3FavorableFavorableUnfavorableMale
4UnfavorableFavorableFavorableFemale

 

I need to calculate the % Favorable for each category for each question, such as for Q1, for female %favorable=50%, Male=100%. I have several categories to add such as level, department etc. however I am struggling to calculate the % of total but show only value for favorable, as if I filter it doesn't take all the values in the denominator. I need this for a matrix format.

 

LevelFemale%Male%
Consultant50%100%
Senior......

Kindly advise on how to proceed.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@curiouspowerbi , Try measure like example

 

divide(Countrows(filter(Table, Table[Q1] ="Favorable")),Countrows(all(Table[Q])))

View solution in original post

3 REPLIES 3
curiouspowerbi
New Member

Thanks @amitchandak . I tried this, however the denominator doesn't seem to work. It is not counting the rows in the Q1 of the table. It is showing the value 4 when I have around 10000 rows.

Also, in my matrix, I have gender and level as two dimensions, please advise how I can get this to work that the % is calculated for the dimensions in the matrix.

Thanks for the guidance. I actually ended up using counta for the denominator and it worked fine.

amitchandak
Super User
Super User

@curiouspowerbi , Try measure like example

 

divide(Countrows(filter(Table, Table[Q1] ="Favorable")),Countrows(all(Table[Q])))

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.