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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
WJ876400
Helper IV
Helper IV

Measure for colour coding

Hi

 

I have the below table, it shows  3 students and 3 modules, each module has two elements to it. The 4th column shows what % that contributes to the grade.  Below is what I have done on excel and the formulas I have used and I am looking to replicate this on BI.

 

What I want to do is calculate-

the weighting Factor which is =D2/240

Marks towards Total Grade =(E2*F2/SUM(F2:F7)

Total Mark =SUM(G2:G7)

RAG Status  =IF(COUNTIF(E2:E7,"<40")>0,"Red",IF(AVERAGE(E2:E7)>=60,"Green","Amber"))

 

I am struggling with how to do the sums for each student, to count the six rows for each stucdent and get the Marks towards total grade and Total Mark and RAG status.

 

Hope this makes sense any help would be greatly appreciated 

 

 

 ABCDEFGHI
1NameModuleTypeWeighting towards 100% ModuleMarkWeighting FactorMark towards total GradeTotal MarkRAG Status
2Student 11Coursework70500.29166666711.6666666754.78333333Red
3Student 11Exam30600.1256  
4Student 12Coursework50380.2083333336.333333333  
5Student 12Exam50280.2083333334.666666667  
6Student 13Coursework65710.27083333315.38333333  
7Student 13Exam35920.14583333310.73333333  
8Student 21Coursework70700.29166666716.3333333379.95Green
9Student 21Exam30670.1256.7  
10Student 22Coursework50890.20833333314.83333333  
11Student 22Exam50900.20833333315  
12Student 23Coursework65900.27083333319.5  
13Student 23Exam35650.1458333337.583333333  
14Student 31Coursework70450.29166666710.551.03333333Amber
15Student 31Exam30520.1255.2  
16Student 32Coursework50480.2083333338  
17Student 32Exam50510.2083333338.5  
18Student 33Coursework65600.27083333313  
19Student 33Exam35500.1458333335.833333333  
1 ACCEPTED SOLUTION

Hi @WJ876400 

 

I just renamed the measures so you can tell them. 1 point need to confirm that Total Mark =SUM(G2:G7) you mentioned before should be named as Total Mark towards Total Grade (I use TotalMarkTowards in measure), and the real Total Marks = SUM(E2:E7)

 

Then total Mark Towards for each Student which adds up their marks towards total grade =: 

Measure = [Marks towardsTotalGrade]+[ToTalMarktowards]

And the conditional color based on it. do you mean like this below?

004.PNG

You can refer to this similar post for reference: https://community.powerbi.com/t5/Desktop/Conditional-formatting-on-Strings-table-cells/td-p/784516

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @WJ876400 

 

Based on your logic, please use below measures:

Measure = CALCULATE(SUM('Table (2)'[Mark]),ALLEXCEPT('Table (2)','Table (2)'[Name]))
Measure 2 = MAX('Table (2)'[Weighting towards 100% Module])*MAX('Table (2)'[Mark])/[Measure]
Measure 3 = CALCULATE(SUM('Table (2)'[Weighting Factor]),ALLEXCEPT('Table (2)','Table (2)'[Name]))
Measure 4 = var a = CALCULATE(COUNT('Table (2)'[Mark]),FILTER(ALLEXCEPT('Table (2)','Table (2)'[Name]),[Mark]<40))
var b = CALCULATE(AVERAGE('Table (2)'[Mark]),ALLEXCEPT('Table (2)','Table (2)'[Name]))
Return
IF(a>0,"Red",IF(b>=60,"Green","Amber"))

09.PNG

 

PBIX attached.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @v-diye-msft 

 

Thank you for sending this i will work through it and see if it works. How do I get a total Mark for each Student which adds up their marks towards total grade? And then have the colour based on that?

 

thanks again

Attached the pbix again.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @WJ876400 

 

I just renamed the measures so you can tell them. 1 point need to confirm that Total Mark =SUM(G2:G7) you mentioned before should be named as Total Mark towards Total Grade (I use TotalMarkTowards in measure), and the real Total Marks = SUM(E2:E7)

 

Then total Mark Towards for each Student which adds up their marks towards total grade =: 

Measure = [Marks towardsTotalGrade]+[ToTalMarktowards]

And the conditional color based on it. do you mean like this below?

004.PNG

You can refer to this similar post for reference: https://community.powerbi.com/t5/Desktop/Conditional-formatting-on-Strings-table-cells/td-p/784516

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @v-diye-msft 

 

thanks for your help with this. How did you calculate the TotalMarksTowards column. I have the below so far but cant seem to add up the Mark towards for each student

 

Capture3.PNG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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