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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Leeny127
Frequent Visitor

Calculate the Top 3 Columns with the Most Instances of One Word

I have a table that shows which questions on a test were answered correctly by student (No = incorrect, Yes = correct)

 

Student       Question-A     Question-B     Question-C     Question-D     Question-E     Question-F

   Joe                  No                   Yes                   Yes                   Yes                    No                  Yes

   Ian                   No                   Yes                   Yes                   Yes                    No                  Yes      

   Tia                   No                    No                   Yes                   Yes                    Yes                  Yes

 

What I would like to do is: 

1) Calculate the top 3 questions with the most "No" answers and display them in a visual

2) Show the percentage of all "Nos" in the table that question accounts for

 

For example: the following questions would show up in my visual (multi row card perhaps), in order of highest "No" count

Question-A    17%

Question-E     11%

Question-B     6%

 

Any guidance is much appreciated!

1 ACCEPTED SOLUTION
Interkoubess
Solution Sage
Solution Sage

Hi @Leeny127,

 

Please modify your data with Power Query by unpivoting all the anwer and keeping the student field.

Then load it in the power pivot model and you can use this formula where I called my table(Table1), and the 3 fields Student, Answer and Question:

 

Measure = var AnswerNo=CALCULATE(COUNT(Table1[Answer]),Table1[Answer]="No") var AnswerAl=CALCULATE(COUNT(Table1[Answer]), ALL(Table1[Question])) return DIVIDE(AnswerNo,AnswerAl,BLANK())

Please feel free to ask it it does not work because it works on my side.

 

NinterTestNo.PNG

View solution in original post

1 REPLY 1
Interkoubess
Solution Sage
Solution Sage

Hi @Leeny127,

 

Please modify your data with Power Query by unpivoting all the anwer and keeping the student field.

Then load it in the power pivot model and you can use this formula where I called my table(Table1), and the 3 fields Student, Answer and Question:

 

Measure = var AnswerNo=CALCULATE(COUNT(Table1[Answer]),Table1[Answer]="No") var AnswerAl=CALCULATE(COUNT(Table1[Answer]), ALL(Table1[Question])) return DIVIDE(AnswerNo,AnswerAl,BLANK())

Please feel free to ask it it does not work because it works on my side.

 

NinterTestNo.PNG

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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