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
Anonymous
Not applicable

Need help getting to % on filtered data

I think there is a simple answer to what I'm trying to do, but I've been looking at it too long and can't see the forest through the trees now.  Given a table of survey responses, using the CARD visualization, I simply want to display the % of satisfied survey responses.  I have played with measures, but I couldn't get it to work in concert with the slicers (assuming because the measures I tried used Calculate with a filter which I think bypasses the slicers). 

 

I have attached a test pbix file here to illustrate what I'm trying to do:  Test.pbix

 

 

 

Thank you!

 

Dan

2 ACCEPTED SOLUTIONS
knotpc
Advocate I
Advocate I

I would solve by creating TWO new columns in your table. 

 

Dissatisfied = IF(SurveyResponses[Satisfaction]="Dissatisfied",1,0)
Satisfied = IF(SurveyResponses[Satisfaction]="Satisfied",1,0)
 
I would then create these measures
 
Total Dissatisified = SUM(SurveyResponses[Dissatisfied])
Total Satisfied = SUM(SurveyResponses[Satisfied])
Total Survey = [Total Satisfied]+[Total Dissatisified]
%Satisfied = [Total Satisfied]/[Total Survey] "You need to format this as a percentage"
 
After you do all of the above then drag the %Satisified measure into the Values field for your card. 
 
That would be my approach, your mileage may vary. 
 
 

 

View solution in original post

tarunsingla
Solution Sage
Solution Sage

Hi Dan,

 

Try this measure.

 

% of Satisfied Responses =
var satisfiedResponses = CALCULATE(COUNT(SurveyResponses[Satisfaction]), LOWER(SurveyResponses[Satisfaction]) = "satisfied")
var totalResponses = CALCULATE(COUNT(SurveyResponses[Satisfaction]))
RETURN IF(ISBLANK(satisfiedResponses), 0, CALCULATE(DIVIDE(satisfiedResponses, totalResponses,0)))
 
And with this field selected, go to Modeling tab, change the Formatting to %; set the decimal places per your need.
 
SampleMeasure.png
 
Regards,
Tarun

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

View solution in original post

4 REPLIES 4
tarunsingla
Solution Sage
Solution Sage

Hi Dan,

 

Try this measure.

 

% of Satisfied Responses =
var satisfiedResponses = CALCULATE(COUNT(SurveyResponses[Satisfaction]), LOWER(SurveyResponses[Satisfaction]) = "satisfied")
var totalResponses = CALCULATE(COUNT(SurveyResponses[Satisfaction]))
RETURN IF(ISBLANK(satisfiedResponses), 0, CALCULATE(DIVIDE(satisfiedResponses, totalResponses,0)))
 
And with this field selected, go to Modeling tab, change the Formatting to %; set the decimal places per your need.
 
SampleMeasure.png
 
Regards,
Tarun

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

I would solve by creating TWO new columns in your table. 

 

Dissatisfied = IF(SurveyResponses[Satisfaction]="Dissatisfied",1,0)
Satisfied = IF(SurveyResponses[Satisfaction]="Satisfied",1,0)
 
I would then create these measures
 
Total Dissatisified = SUM(SurveyResponses[Dissatisfied])
Total Satisfied = SUM(SurveyResponses[Satisfied])
Total Survey = [Total Satisfied]+[Total Dissatisified]
%Satisfied = [Total Satisfied]/[Total Survey] "You need to format this as a percentage"
 
After you do all of the above then drag the %Satisified measure into the Values field for your card. 
 
That would be my approach, your mileage may vary. 
 
 

 

Anonymous
Not applicable

I tested it and it works great.  Thank you!

Anonymous
Not applicable

Thank you, this was the solution I chose to move forward with, even though the other solution worked too.  Thanks a bunch!

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.