Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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 visu...
  • knotpc's avatar
    7 years ago

    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. 
     
     

     

  • tarunsingla's avatar
    7 years ago

    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.
     
     
    Regards,
    Tarun

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