Forum Discussion

jambopriti's avatar
jambopriti
Icon for Helper I rankHelper I
1 year ago
Solved

Survey Analysis: Count and Add the response

Hi,

I'm new to Power BI and need help in Survey analysis.

I need to add count of top 2 responses. Would you please show how to do it?

I have attached the test file.

I'm trying to get this result.

test data:

 

Respondent_idquestionanswer
5751How satisfied are you with the web site experience?Very Satisfied
5752How satisfied are you with the web site experience?Satisfied
5753How satisfied are you with the web site experience?Very Satisfied
5760How satisfied are you with the web site experience?Very Satisfied
5761How satisfied are you with the web site experience?Satisfied
5762How satisfied are you with the web site experience?Very Satisfied
5763How satisfied are you with the web site experience?Neutral
5764How satisfied are you with the web site experience?Very Satisfied
5767How satisfied are you with the web site experience?Very Satisfied
5769How satisfied are you with the web site experience?Satisfied
5770How satisfied are you with the web site experience?Very Satisfied
5772How satisfied are you with the web site experience?Satisfied
5775How satisfied are you with the web site experience?Very Satisfied
5776How satisfied are you with the web site experience?Satisfied
5778How satisfied are you with the web site experience?Very Satisfied
5779How satisfied are you with the web site experience?Very Satisfied
5780How satisfied are you with the web site experience?Very Satisfied
5781How satisfied are you with the web site experience?Satisfied
5783How satisfied are you with the web site experience?Very Satisfied
5785How satisfied are you with the web site experience?Satisfied
5787How satisfied are you with the web site experience?Neutral
5788How satisfied are you with the web site experience?Very Satisfied
5789How satisfied are you with the web site experience?Neutral
5790How satisfied are you with the web site experience?Very Satisfied
5791How satisfied are you with the web site experience?Very Satisfied
5792How satisfied are you with the web site experience?Neutral
5793How satisfied are you with the web site experience?Satisfied
5795How satisfied are you with the web site experience?Very Satisfied
5796How satisfied are you with the web site experience?Satisfied
5797How satisfied are you with the web site experience?Satisfied
5799How satisfied are you with the web site experience?Satisfied
5800How satisfied are you with the web site experience?Very Satisfied
   

 

 

  • jambopriti Review the following screenshot and measure. Hope it works.

    COunt Answers = COUNT('Table'[answer])/CALCULATE(COUNT('Table'[answer]),All('Table'))

     

    Top2ResponsesPercentage = 

    VAR TopNTable =
        TOPN(
            2,
            ALL('Table'[answer]),
            [COunt Answers],        
            DESC
        )

    RETURN
        SUMX(
          TopNTable,
            [COunt Answers]        
      )

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

  • fahadqadir3's avatar
    fahadqadir3
    1 year ago

    Review the pbix file attached,

    Top2ResponsesPercentage =

    VAR TopNTable =

        TOPN(

            2,

            ALL('Table'[answer]),

            [COunt Answers %],        

            DESC

        )

    RETURN

        SUMX(

          TopNTable,

            [COunt Answers %]        

      )

     

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

     

  • jambopriti's avatar
    jambopriti
    1 year ago

    Perfect! It is working! Thank you so much for your solution and support! 

9 Replies

  • fahadqadir3's avatar
    fahadqadir3
    Icon for Solution Supplier rankSolution Supplier

    jambopriti Review the following screenshot and measure. Hope it works.

    COunt Answers = COUNT('Table'[answer])/CALCULATE(COUNT('Table'[answer]),All('Table'))

     

    Top2ResponsesPercentage = 

    VAR TopNTable =
        TOPN(
            2,
            ALL('Table'[answer]),
            [COunt Answers],        
            DESC
        )

    RETURN
        SUMX(
          TopNTable,
            [COunt Answers]        
      )

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!

  • Thank you. one more question. 

    my card display 0.88, How do I convert into percentage? sorry this is so dumbquestion but I'm totally new to Power BI and learning.

    • fahadqadir3's avatar
      fahadqadir3
      Icon for Solution Supplier rankSolution Supplier

      jambopriti Click on % Sign, 

       

       

      Did I answer your question? Mark my post as a solution! This will help others on the forum!
      Appreciate your Kudos!!

       

      • jambopriti's avatar
        jambopriti
        Icon for Helper I rankHelper I

        Thank you so much!!! 

        It is working. I'll mark this as a solution! Truly appreciate your help!

    • jambopriti's avatar
      jambopriti
      Icon for Helper I rankHelper I

      Hi,

      Sorry, when I apply to real data I got the wrong calculation because my data may have 

      Very Satisfied, Satisfied, Neutral, Dissatisfied, very Dissatisfied. 

      Is there a way I can rank 5,4,3,2,1? my data model do not have the rank. How can I achieve this.

      Sorry, I should have mention this.