Forum Discussion

Pamdelorbe's avatar
Pamdelorbe
Frequent Visitor
3 years ago
Solved

Assign numeric value to a specific text string to get an average

Hi everyone!

 

I'm analyzing the answers of a survey in order to get the general score of each response.  The issue is that the responses are text strings. Por example "Excellent, "very good", "good", etc". 

 

I guess that first I have to assign a numeric value to each text string. For example, Excellent =5, Very good =4, Good =3, etc. I already try to create a new conditional column but didn't work since I need to multiply the total the count of response by the value assigned to get the total score of each value (i.e. Excellent score =18 x 5). 

 

For example, This is how data looks like. 

 

What I need is to create a formula that multiply each response (i.e excellent =18) by the assigned value (i.e = 5) then divided the sum of total assigned value by the sum of total count responses in order to get the average score (see below).

 

Parking facilitesCount of Parking facilites (responses)CP Parking Facilities (assigned value)Total
Excellent18590
Very good15460
Good15345
Fair7214
Poor111
Did not use/ notice100
SUM57 210
    
AV. SCORE3.68Sum of total (210) / sum of count responses (57)

 

Any help will be more than welcome!

 

I'm super new in power Bi really appreciate very detailed responses. 

 

Thanks in advance!!

  • Hi Pamdelorbe , try this:

    -  Table 1 is something like this

    - Table 2 is something like this

    - Create this relationship:

     

     

    - Create this calculate column:

    - Create this measure:

     

    - Create another this measure:

     

    - Create the measure to the average:

     

     

    The result:

     

    I hope you works it, Best regards

     

     

     

     

     

     

     

  • Hi Pamdelorbe , you can remove the relationships between the 2 tables, and follow this steps:

    - Create (for example) this calculate columns:

    The result is this:

     

    - Create the measures to counts and averages:

     

    The result is:

    - When you insert the filelds (columns) to design the table, choose Don´t resume in this 2 column:

    If you have problems let me know, 

    Best regards!

     

     

7 Replies

  • Hi Pamdelorbe , try this:

    -  Table 1 is something like this

    - Table 2 is something like this

    - Create this relationship:

     

     

    - Create this calculate column:

    - Create this measure:

     

    - Create another this measure:

     

    - Create the measure to the average:

     

     

    The result:

     

    I hope you works it, Best regards

     

     

     

     

     

     

     

  • The second measure you don't have to create, it's the calculated column:

     

    • Pamdelorbe's avatar
      Pamdelorbe
      Frequent Visitor

      Hi Binifity, 

       

      That was so so helpful! Thanks for take the time to answer with so much details. Millon thanks!!!

       

      I just have one more quest. How can I make this scalable for the rest of my survey answers? Do i need to create a calculated colum and both measures for each response... For example this was for parking facilites and I want to get the average result from parking accesability, value for money, etc (same answers range apply: "Excellent", "Very good", "Good", etc..)

       

      Million thanks in advance!! 

      • Bifinity_75's avatar
        Bifinity_75
        Icon for Solution Sage rankSolution Sage

        Hi Pambdelorbe, it is fully scalable.  The only requirement is that the source tables must have the same structure, and the name of the columns must remain the same as long as they are referenced in power query, for example for a type change:

         

        Original data source (with another name of column):

         

        And error in Power Query, because the column name has changed to apply the type change:

        If in power query you have not applied any type of change referring to the columns, and the structure of the table is the same, you can scale it without problems.

        I hope I have helped you, greetings