Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I work at a high school using a hybrid schedule. Some students in on A days and others in on B days. Some parents want their kids at school everyday (A-S, B-S designations on their record) I need to figure out how many A hybrid and B student kids are in each class to see if we have enough safe room for all in the classroom or if we need to have some students watching the class on Zoom from somewhere else in the building.
Trying to have A-H # and B-S # show and sum when A is selected on the Group slicer and the same for B-H# and A-S# when Group B is selected.
Currently both A's show up when group A is selected and same for B because I originally created new columns using "Group" & "Attend"
Solved! Go to Solution.
Hi @jrmaier ,
You can also create a slicer table:
Then use the following measure in your matrix:
measure =
SWITCH (
SELECTEDVALUE ( 'Table2'[slicer] ),
"A",
IF (
HASONEVALUE ( 'Data'[Code] ),
IF (
MAX ( 'Data'[Code] ) IN { "A-H", "B-S" },
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block] ),
'Data'[Code] = MAX ( 'Data'[Code] )
)
),
BLANK ()
),
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block] ),
'Data'[Code] IN { "A-H", "B-S" }
)
)
),
"B",
IF (
HASONEVALUE ( 'Data'[Code] ),
IF (
MAX ( 'Data'[Code] ) IN { "A-S", "B-H" },
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block] ),
'Data'[Code] = MAX ( 'Data'[Code] )
)
),
BLANK ()
),
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block]),
'Data'[Code] IN { "A-S", "B-H" }
)
)
),
"C",
IF (
MAX ( 'Data'[Code] ) = "C-R",
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block]),
'Data'[Code] = MAX ( 'Data'[Code] )
)
),
BLANK ()
)
For more details, please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EcbBOLH1ufxFtl5jNF...
Please be kind to accept useful reply as answer ,not your own reply.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
The table there is created through the "Enter data" fuctionality, you can edit it directly in power query to match your requirement:
Just make sure that the codes in the "Code" column correspond to the correct codes in the main table.
/ J
Hi @jrmaier ,
You can also create a slicer table:
Then use the following measure in your matrix:
measure =
SWITCH (
SELECTEDVALUE ( 'Table2'[slicer] ),
"A",
IF (
HASONEVALUE ( 'Data'[Code] ),
IF (
MAX ( 'Data'[Code] ) IN { "A-H", "B-S" },
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block] ),
'Data'[Code] = MAX ( 'Data'[Code] )
)
),
BLANK ()
),
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block] ),
'Data'[Code] IN { "A-H", "B-S" }
)
)
),
"B",
IF (
HASONEVALUE ( 'Data'[Code] ),
IF (
MAX ( 'Data'[Code] ) IN { "A-S", "B-H" },
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block] ),
'Data'[Code] = MAX ( 'Data'[Code] )
)
),
BLANK ()
),
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block]),
'Data'[Code] IN { "A-S", "B-H" }
)
)
),
"C",
IF (
MAX ( 'Data'[Code] ) = "C-R",
CALCULATE (
COUNT ( 'Data'[User ID] ),
FILTER (
ALLEXCEPT ( 'Data', 'Data'[Room Number], 'Data'[Course Title], 'Data'[Block]),
'Data'[Code] = MAX ( 'Data'[Code] )
)
),
BLANK ()
)
For more details, please refer to the pbix file: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EcbBOLH1ufxFtl5jNF...
Please be kind to accept useful reply as answer ,not your own reply.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
118 | |
101 | |
71 | |
61 |