Forum Discussion
Dynamic column filtering in a table with multiple headers
- 11 months ago
You’re trying to dynamically hide/show grouped columns with multiple headers in a Fabric (Power BI) table or matrix. Right now you’ve managed single header filtering, but extending to multi-level headers like “1 → 1A,1B,1C” and “2 → 2A,2B,2C” is trickier. Here’s how you can approach it:
1. Model Your Data for Flexibility
Instead of storing each column as a separate field (1A, 1B, 1C, etc.), restructure into a normalized format:
Columns: Category, SubCategory, Value.
Example row: 1 | A | 123.
This lets you control visibility with slicers, because headers are now data instead of hard-coded columns.
2. Use a Matrix with Field Parameters
Power BI supports Field Parameters, which allow end users to dynamically pick which columns/fields to display.
Steps:Create a field parameter with all possible measures (1A, 1B, 1C, 2A, 2B, 2C).
Group them logically by categories (parameter table can include an extra “Category” column).
Add a slicer bound to this parameter so users filter which groups or sub-groups to show.
This way:
If filter = X, you select 1A,1B,2A,2B in the slicer.
If filter = Y, you only select 1A and 2A.
3. Build Hierarchical Headers
The Matrix visual automatically supports stepped layouts:
Put “Category” (1,2) in Columns level 1.
Put “SubCategory” (A,B,C) in Columns level 2.
Now you get a structure like the screenshot, with expandable headers.
4. Apply Dynamic Logic
To automate X vs Y logic instead of manual slicer choice:
Create a disconnected table for filter selection (X,Y).
Write DAX to filter the field parameter table based on selection.
Example:
VisibleColumns = FILTER ( 'Field Parameters', ( SELECTEDVALUE(FilterTable[Filter]) = "X" && 'Field Parameters'[ColumnName] IN {"1A","1B","2A","2B"} ) || ( SELECTEDVALUE(FilterTable[Filter]) = "Y" && 'Field Parameters'[ColumnName] IN {"1A","2A"} ) )Then bind VisibleColumns to the Matrix.
5. Limitations
You cannot truly “hide” a column header dynamically in Power BI unless you use Field Parameters or measures. Otherwise, blank values still show.
For Fabric, the recommended way is to restructure data and use Matrix + Parameters, not to manage static wide tables.
Hi Jcwinter,
Thank you for reaching out to Microsoft Fabric Community.
Thank you MJParikh and tayloramy for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa