Forum Discussion
Help Calculating School Performance Index in Power BI (Complicated Calculation in Power BI)
- Anonymous3 years ago
Hi Anonymous ,
Please new two measures:
percentage = VAR _count = COUNTROWS('Table') + 0 VAR _total = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[subject],'Table'[school_year])) VAR _percentage = DIVIDE(_count,_total) RETURN _percentagepoints = VAR _subject= MAX('Table'[subject]) VAR _year = MAX('Table'[school_year]) VAR _Advanced = SUMX(FILTER('Table','Table'[subject]=_subject&&'Table'[school_year]=_year&&'Table'[performance_level]="Advanced"),[percentage])+0 VAR _Proficient = SUMX(FILTER('Table','Table'[subject]=_subject&&'Table'[school_year]=_year&&'Table'[performance_level]="Proficient"),[percentage])+0 VAR _Limited = SUMX(FILTER('Table','Table'[subject]=_subject&&'Table'[school_year]=_year&&'Table'[performance_level]="Limited"),[percentage])+0 VAR _Point = (_Advanced*2+_Proficient+_Limited*0.5)*100 RETURN _PointM or DAX? That is the Question
KNP's answer:
When should I favor DAX over PowerQuery for perfor...
Comparing DAX calculated columns with Power Query computed columns
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi Anonymous ,
Please new two measures:
percentage =
VAR _count = COUNTROWS('Table') + 0
VAR _total = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[subject],'Table'[school_year]))
VAR _percentage = DIVIDE(_count,_total)
RETURN
_percentagepoints =
VAR _subject= MAX('Table'[subject])
VAR _year = MAX('Table'[school_year])
VAR _Advanced = SUMX(FILTER('Table','Table'[subject]=_subject&&'Table'[school_year]=_year&&'Table'[performance_level]="Advanced"),[percentage])+0
VAR _Proficient = SUMX(FILTER('Table','Table'[subject]=_subject&&'Table'[school_year]=_year&&'Table'[performance_level]="Proficient"),[percentage])+0
VAR _Limited = SUMX(FILTER('Table','Table'[subject]=_subject&&'Table'[school_year]=_year&&'Table'[performance_level]="Limited"),[percentage])+0
VAR _Point = (_Advanced*2+_Proficient+_Limited*0.5)*100
RETURN
_Point
M or DAX? That is the Question
KNP's answer:
When should I favor DAX over PowerQuery for perfor...
Comparing DAX calculated columns with Power Query computed columns
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Wow, thank you so much for the help with this! I do have one question -- what is the reason for adding a zero at the end of the SUMX calculations? Is it so it doesn't return an error in the case of a null/blank value?