Special shout out to @AUaero for helping out with the foundation for this problem (https://community.powerbi.com/t5/Desktop/calculation-to-show-value-for-NOT-variable/m-p/2665613) by showing me how to create a "not selected" calculation so that I can compare ingroup rates to out of group rates for a metric and allowing those rates to be filtered by ONE slicer.
I am now trying to expand this effort so that the calculation can be filtered by more than one filter. I want to build a Matrix table that shows the student completion rate based on faculty tenure status and compare to the completion rates for other faculty statuses combined. Furthermore, these rates should dynamically adjust based on Division selected and Student Gender.
For instance, I'm creating a table where I want to see the rates of student completion for Adjunct instructors within the Humanities Division for female students compared to the completion rates for Full time and Tenured instructors within the Humanities Division for female students.
Division Slicer | Humanities | ||
Student Gender Slicer | F | ||
Row Labels | Group rate | NonGroup Rate | |
Adjunct | 88% | 82% | non group rate includes non-Adjunct, Humanities instructors, Female Students |
FT, Not Tenured | 83% | 83% | non group rate includes non-"FT, Not Tenured", Humanities instructors, Female Students |
Tenure | 81% | 85% | non group rate includes non-Tenured, Humanities instructors, Female Students |
This is an example of my data:
Instructor Status | Division | Student Gender | Enrolled | TaskComplete |
Adjunct | Humanities | F | 80 | 70 |
Adjunct | Humanities | M | 65 | 60 |
Adjunct | Humanities | O | 4 | 3 |
FT, Not Tenured | Humanities | F | 120 | 100 |
FT, Not Tenured | Humanities | M | 110 | 100 |
FT, Not Tenured | Humanities | O | 3 | 1 |
Tenure | Humanities | F | 160 | 130 |
Tenure | Humanities | M | 180 | 135 |
Tenure | Humanities | O | 6 | 2 |
Adjunct | STEM | F | 60 | 40 |
Adjunct | STEM | M | 80 | 70 |
Adjunct | STEM | O | 2 | 1 |
FT, Not Tenured | STEM | F | 43 | 40 |
FT, Not Tenured | STEM | M | 75 | 70 |
FT, Not Tenured | STEM | O | 0 | 0 |
Tenure | STEM | F | 75 | 60 |
Tenure | STEM | M | 120 | 80 |
Tenure | STEM | O | 3 | 2 |
Ideally, the solution should work if only one or no slicers are selected as well. I can create one or the other of these next two examples using the solution provided by @AUaero , but the calculation gets funky if more than one slicer is selected.
Division Slicer | Humanities | ||
Student Gender Slicer | |||
Row Labels | Group rate | NonGroup Rate | |
Adjunct | 89% | 81% | non group rate includes non-Adjunct, Humanities instructors, all Genders |
FT, Not Tenured | 86% | 81% | non group rate includes non-"FT, Not Tenured", Humanities instructors, all Genders |
Tenure | 77% | 87% | non group rate includes non-Tenured, Humanities instructors, all Genders |
or
Division Slicer | |||
Student Gender Slicer | Female | ||
Row Labels | Group rate | NonGroup Rate | |
Adjunct | 79% | 83% | non group rate includes non-Adjunct, instructors from all Divisions, Female Students |
FT, Not Tenured | 86% | 80% | non group rate includes non-"FT, Not Tenured", instructors from all Divisions, Female Students |
Tenure | 81% | 83% | non group rate includes non-Tenured, instructors from all Divisions, Female Students |
This is the example if no slicers are selected. Here the solution would compare outcomes for all Divisions and students.
Division Slicer | |||
Student Gender Slicer | |||
Row Labels | Group rate | NonGroup Rate | |
Adjunct | 84% | 80% | non group rate includes non-Adjunct, instructors from all Divisions, all Gender Students |
FT, Not Tenured | 89% | 78% | non group rate includes non-"FT, Not Tenured", instructors from all Divisions, all Genders |
Tenure | 75% | 86% | non group rate includes non-Tenured, instructors from all Divisions, all Genders |
In all of these cases, we are comparing each tenure status category with all of the other tenure status categories.
Thank you in advance for your brilliant solutions.
-J
Solved! Go to Solution.
Thanks for the shoutout, @JoRo50! I loaded your sample data and was able to get the results you specified in your examples with these measures:
% Completion =
VAR SumEnrolled = SUM('SampleData'[Enrolled])
VAR SumTaskComplete = SUM('SampleData'[TaskComplete])
RETURN
DIVIDE(SumTaskComplete, SumEnrolled)
% Complete - Non-Group Rate =
VAR ThisInstructorStatus = MAX(SampleData[InstructorStatus])
RETURN
CALCULATE(
[% Completion],
FILTER(
ALLEXCEPT(SampleData, SampleData[Division], SampleData[StudentGender]),
NOT(SampleData[InstructorStatus] = ThisInstructorStatus)
)
)
Does this get you what you are looking for?
@AUaero Thank you. It was a simple solution but required tweaking your original solution. I had been using various other charachters to link my filters that I found in other online solutions but they didn't work.
Thanks for the shoutout, @JoRo50! I loaded your sample data and was able to get the results you specified in your examples with these measures:
% Completion =
VAR SumEnrolled = SUM('SampleData'[Enrolled])
VAR SumTaskComplete = SUM('SampleData'[TaskComplete])
RETURN
DIVIDE(SumTaskComplete, SumEnrolled)
% Complete - Non-Group Rate =
VAR ThisInstructorStatus = MAX(SampleData[InstructorStatus])
RETURN
CALCULATE(
[% Completion],
FILTER(
ALLEXCEPT(SampleData, SampleData[Division], SampleData[StudentGender]),
NOT(SampleData[InstructorStatus] = ThisInstructorStatus)
)
)
Does this get you what you are looking for?