Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
orinocoworkflow
Regular Visitor

Calculating a 'quality score' from likert scale survey responses

My math brain is being pushed to its limit on this one so hoping someone can help. I've been poking around the board for a few weeks but I haven't been able to find the answer I need.

 

I have to write a formula in PowerBI to give me a ‘quality score’ from likert scale survey responses. The formula I need to write is:

 

Quality score = % of agrees (agree and strongly agree)
                           Total number of responses


Because I have to be able to cut it by a number of factors (department name, as per the dummy data below, and others to follow), it makes more sense for it to be a measure in PowerBi attached to a visual instead of something built into my alteryx workflow (each line by itself cannot have its own quality score, the score can only be calculated when looking at a group).

 

In this example, the quality score for Crockery would be 71.4% and for Homewares it would be 85.7%

 

Here is the type of data I'm looking at:

 

RecordIDDepartmentSub-departmentSectionNameValue
581HomewaresDiningCrockerya. Good product selectionAgree
581HomewaresDiningCrockeryb. Had products suited to my needsAgree
581HomewaresDiningCrockeryc. Had helpful employeesAgree
581HomewaresDiningCrockeryd. Easy to find what I neededNeutral
581HomewaresDiningCrockerye. Prices were fairAgree
581HomewaresDiningCrockeryf. Good quality of productsAgree
581HomewaresDiningCrockeryg. Wait time to check out was goodNeutral
582ClothingShoesKid's shoesa. Good product selectionStrongly Agree
582ClothingShoesKid's shoesb. Had products suited to my needsNeutral
582ClothingShoesKid's shoesc. Had helpful employeesStrongly Agree
582ClothingShoesKid's shoesd. Easy to find what I wantedAgree
582ClothingShoesKid's shoese. Prices were fairAgree
582ClothingShoesKid's shoesf. Good quality of productsStrongly Agree
582ClothingShoesKid's shoesg. Wait time to check out was goodAgree
605HomewaresKitchenSaucepansa. Good product selectionStrongly Agree
605HomewaresKitchenSaucepansb. Had products suited to my needsStrongly Agree
605HomewaresKitchenSaucepansc. Had helpful employeesStrongly Agree
605HomewaresKitchenSaucepansd. Easy to find what I wantedStrongly Agree
605HomewaresKitchenSaucepanse. Prices were fairStrongly Agree
605HomewaresKitchenSaucepansf. Good quality of productsStrongly Agree
605HomewaresKitchenSaucepansg. Wait time to check out was goodStrongly Agree

 

I appreciate any help you have to offer.

1 ACCEPTED SOLUTION

Hi @orinocoworkflow 
I don't sure that understood correctly the desired result so created 2 versions with a similar basis. 
I created 3 measures :
1. Basic count of agree +strongly agree

Agree_st = CALCULATE(COUNTROWS('Table'),'Table'[Value]="agree"||'Table'[Value]="strongly agree")
2. count the percent by department:
%_agree_by_department = DIVIDE(CALCULATE([Agree_st],ALLSELECTED('Table'[Section])),CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'[Section])))
3. 
%_agree_by_section = DIVIDE(CALCULATE([Agree_st],ALLSELECTED('Table'[Department])),CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'[Department])))
this is good enough for a "flat" visual 
Ritaf1983_0-1705300312999.png

If you want something hierarchical you can use measures like:

%agree_by_hierarchy = if(ISINSCOPE('Table'[Section]),[%_agree_by_section],[%_agree_by_department])
The result :
Ritaf1983_1-1705300444464.png

pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
orinocoworkflow
Regular Visitor

Great, thank you!! I will carve out some time this week to try to get it working with my data set. I'm still a beginner so it may take me awhile to get this running but I will accept the solution if I can get it going.

Ritaf1983
Super User
Super User

Hi @orinocoworkflow 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Thanks, I couldn't figure out how to add data in. I've now been able to add it in as a table - I hope it's coming across in an acceptable format.

Hi @orinocoworkflow 
I don't sure that understood correctly the desired result so created 2 versions with a similar basis. 
I created 3 measures :
1. Basic count of agree +strongly agree

Agree_st = CALCULATE(COUNTROWS('Table'),'Table'[Value]="agree"||'Table'[Value]="strongly agree")
2. count the percent by department:
%_agree_by_department = DIVIDE(CALCULATE([Agree_st],ALLSELECTED('Table'[Section])),CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'[Section])))
3. 
%_agree_by_section = DIVIDE(CALCULATE([Agree_st],ALLSELECTED('Table'[Department])),CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'[Department])))
this is good enough for a "flat" visual 
Ritaf1983_0-1705300312999.png

If you want something hierarchical you can use measures like:

%agree_by_hierarchy = if(ISINSCOPE('Table'[Section]),[%_agree_by_section],[%_agree_by_department])
The result :
Ritaf1983_1-1705300444464.png

pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

This is along the lines of what I need but I'm wondering if there is a formula that can encompass any other variable I may add in the future. For example, if I add a column for Salesperson or day of the week, I would want a measure that could calculate quality scores for those variables as well, without me having to input an additional formula for each new column I may add.

 

If this is not something you think is possible, please let me know.

 

I appreciate you taking the time to have a go.

Andrea

Hi @orinocoworkflow 
If the goal is to show the measure based on the categorical column that you put on the visual you can select the column via field parameters, using a similar logic that I showed with isincope 

with selectedvalue based on the parameter (column) that you put on the visual.

more information about field parameters by the link:

https://www.youtube.com/watch?v=TLiqqIsk1CU&t=16s

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.