Forum Discussion
Anonymous
6 years agoNot applicable
Use count that apply on a filter
I have this measure:
#avg grade to pass = DIVIDE(CALCULATE(SUM(StudentResults[result]); StudentResults[result] >= 5,5); DISTINCTCOUNT(StudentResults[studnr]))
It needs to calculate the average grade it took a student to pass (which is 5,5 of higher). But my measure also counts the students that did not pass, the filter is not applied to the count. How can I solve this?
Table:
studnr course result
| 105 | B | 6,1 |
| 105 | B | 3,9 |
| 105 | A | 9,1 |
| 104 | B | 7,8 |
| 104 | B | 4,6 |
| 103 | A | 6,6 |
| 102 | A | 4,6 |
| 102 | B | 5,4 |
| 102 | B | 4,4 |
| 102 | B | 3,1 |
| 101 | B | 7,6 |
| 101 | B | 3,5 |
| 101 | B | 3,1 |
| 101 | A | 7 |
| 101 | A | 3,7 |
Try this.
#avg grade to pass = CALCULATE(DIVIDE(SUM(StudentResults[result]);DISTINCTCOUNT(StudentResults[studnr]));StudentResults[result] >= 5,5)If I answered your question, please mark my post as solution, this will also help others.Please give Kudos for support.Looking for German Power BI content? Visit my blog.
http://www.thinkbi.de/
3 Replies
- mwegener
Most Valuable Professional
Try this.
#avg grade to pass = CALCULATE(DIVIDE(SUM(StudentResults[result]);DISTINCTCOUNT(StudentResults[studnr]));StudentResults[result] >= 5,5)If I answered your question, please mark my post as solution, this will also help others.Please give Kudos for support.Looking for German Power BI content? Visit my blog.
http://www.thinkbi.de/- AnonymousNot applicable
Nice! It works, did not know that you can use the calculate like that.
- mwegener
Most Valuable Professional
I recommend this free "Introducing DAX Video Course"
https://www.sqlbi.com/p/introducing-dax-video-course/
Please give Kudos for support.