The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
139 | |
106 | |
105 | |
74 | |
60 |
User | Count |
---|---|
266 | |
127 | |
119 | |
100 | |
88 |