Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have created a Power BI Dashboard for a UK secondary school. We have various behaviour events in our MIS, which include when pupils are sent to the Hub (where they have to do their work in silence outside of the class to reduce disruption to others). I've written a measure in the behaviour table to count the number of times pupils are sent to the Hub (which can be for a few different reasons). I would like to filter on a card which shows the average grade (from another table) to show the impact of pupils who are in the Hub far more than others. However, when I add the measure to the card's "Filter on this visual" section, it won't let me do anything (e.g. set the filter to <=1). A slicer doesn't accept the measure at all.
I found a YouTube video (https://www.youtube.com/watch?v=AZAL-QPn5Zc) on the subject and copied the DAX and clicked the edit interactions, but this hasn't worked. Full details are below - if anyone can help with a solution, I'd very much appreciate it.
Pupil_Data Table
| External ID | Name | Free School Meals | Special Education Needs |
| 1 | Pupil One | N | N |
| 2 | Pupil Two | N | N |
| 3 | Pupil Three | Y | N |
| 4 | Pupil Four | N | K |
| 5 | Pupil Five | N | N |
| 6 | Pupil Six | Y | K |
| 7 | Pupil Seven | N | N |
| 8 | Pupil Eight | Y | N |
| 9 | Pupil Nine | N | E |
| 10 | Pupil Ten | Y | E |
Behaviour Table
| External ID | Date | Behaviour Type |
| 1 | 05/09/2024 | B7 The Learning Hub |
| 1 | 07/01/2025 | No Homework |
| 1 | 20/09/2024 | B7 The Learning Hub - 3 Strikes |
| 1 | 03/10/2024 | B1 No PE Kit |
| 2 | 07/10/2024 | B5 Suspension |
| 2 | 03/03/2025 | B7 The Learning Hub - Lates |
| 3 | 17/03/2025 | No Homework |
| 3 | 17/03/2025 | B7 The Learning Hub - 3 Strikes |
| 3 | 18/03/2025 | B7 The Learning Hub |
| 3 | 20/03/2025 | B7 The Learning Hub - Lates |
| 4 | 27/03/2025 | B7 The Learning Hub |
| 4 | 02/04/2025 | B7 The Learning Hub - 3 Strikes |
| 5 | 23/04/2025 | No Homework |
| 6 | 20/05/2025 | B7 The Learning Hub - No PROUD Card |
| 6 | 24/09/2024 | No Homework |
| 6 | 12/12/2024 | No Homework |
| 6 | 19/12/2024 | B7 The Learning Hub - 3 Strikes |
| 6 | 30/09/2024 | No Homework |
| 7 | 08/10/2024 | B7 The Learning Hub - Lates |
| 8 | 04/11/2024 | B7 The Learning Hub - No PROUD Card |
| 8 | 18/11/2024 | No Homework |
| 8 | 22/11/2024 | No Homework |
| 8 | 13/12/2024 | B1 No PE Kit |
| 8 | 17/12/2024 | No Homework |
| 9 | 17/12/2024 | B7 The Learning Hub - Lates |
| 9 | 10/01/2025 | No Homework |
| 9 | 16/01/2025 | No Homework |
| 10 | 21/01/2025 | B7 The Learning Hub - Lates |
| 10 | 23/01/2025 | B1 No PE Kit |
| 10 | 05/02/2025 | No Homework |
| 10 | 10/02/2025 | B7 The Learning Hub - No PROUD Card |
| 10 | 25/02/2025 | B5 Suspension |
| 10 | 05/03/2025 | B7 The Learning Hub - 3 Strikes |
Measure to calculate times in the Hub is:
| External ID | Grade | Subject |
| 1 | 8 | English |
| 1 | 7 | Mathematics |
| 1 | 9 | Science |
| 2 | 2 | English |
| 2 | 2 | Mathematics |
| 2 | 3 | Science |
| 3 | 5 | English |
| 3 | 6 | Mathematics |
| 3 | 6 | Science |
| 4 | 7 | English |
| 4 | 8 | Mathematics |
| 4 | 7 | Science |
| 5 | 4 | English |
| 5 | 6 | Mathematics |
| 5 | 8 | Science |
| 6 | 2 | English |
| 6 | 3 | Mathematics |
| 6 | 2 | Science |
| 7 | 4 | English |
| 7 | 5 | Mathematics |
| 7 | 4 | Science |
| 8 | 5 | English |
| 8 | 4 | Mathematics |
| 8 | 3 | Science |
| 9 | 6 | English |
| 9 | 8 | Mathematics |
| 9 | 7 | Science |
| 10 | 6 | English |
| 10 | 4 | Mathematics |
| 10 | 7 | Science |
From the YouTube video I tried:
1) Created a table:
Solved! Go to Solution.
Hi @duesouth ,
Thank you for reaching out to Microsoft Fabric Community.
Above error ( The expression contains columns from multiple tables, but only columns from a single table can be used in a True/False expression that is used as a table filter expression.) can be fixed by replacing it with the below measure. Establish the relation ship between Behaviour and pupil_data using external ID.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Hi @duesouth ,
Power BI doesn't allow you to use a measure as a slicer or directly in visual-level filters because measures are context-dependent and recalculated on the fly. To filter the average grade card by how often a pupil has been sent to the Hub, you need a calculated column that counts the number of times each pupil has been to the Hub. This column can then be used in slicers or as a filter on visuals.
You can add the following calculated column to your Pupil_Data table or whichever table you're using as your base for visuals:
NumberInHub_Column =
CALCULATE (
COUNTROWS ( Behaviour ),
FILTER (
Behaviour,
Behaviour[Behaviour Type] IN {
"B7 The Learning Hub",
"B7 The Learning Hub - 3 Strikes",
"B7 The Learning Hub - Lates",
"B7 The Learning Hub - No PROUD Card"
}
),
Behaviour[External ID] = Pupil_Data[External ID]
)
Once this column is created, you can use it as a visual-level filter in your average grade card. For instance, set the filter to only include pupils with NumberInHub_Column >= 5 to evaluate the impact on students with frequent Hub events. Your average grade measure like this:
Average Grade = AVERAGE(Assessment[Grade])
will now respond to the filter and only show the average for students who meet the specified Hub visit threshold. If you want slicer interactivity, you can also create a GENERATESERIES table and use the selected value from that slicer to filter visuals based on this calculated column. This avoids the issues you faced with measures not being accepted in slicers or filters and gives you the control you need.
Best regards,
Thanks for the reply. I've tried to put in the DAX, but it's returning the error:
"The expression contains columns from multiple tables, but only columns from a single table can be used in a True/False expression that is used as a table filter expression."
The error is under Pupil_Data[External ID]
Any ideas? Thank you!
Hi @duesouth ,
Thank you for reaching out to Microsoft Fabric Community.
Above error ( The expression contains columns from multiple tables, but only columns from a single table can be used in a True/False expression that is used as a table filter expression.) can be fixed by replacing it with the below measure. Establish the relation ship between Behaviour and pupil_data using external ID.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Many thanks for taking the time to help - much appreciated!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |