Forum Discussion
Dynamic colums in a table visual depending on values
I need to display in table visual only columns which doesn't contain null values - see example below ? How can I achieve this? Thanks for help
| Table_data_rows | ||||||||
| Category slicer | column_category | column_name1 | column_name2 | column_name3 | ||||
| category1 | category1 | Cat1_value1 | Cat1_value2 | Cat1_value3 | ||||
| category2 | category2 | NULL | Cat2_value2 | cat2_value3 | ||||
| category3 | category3 | Cat3_value1 | NULL | NULL | ||||
| when Category1 -selected: | Table_visual_display (depending on category selection), dynamic columns depending containing only no-NULL row values | |||||||
| result1 | column_value1 | column_value2 | column_value3 | |||||
| cat1_value1 | cat1_value2 | Cat1_value3 | ||||||
| when Category2 -selected: | column_name2 | column_name3 | ||||||
| result2 | Cat2_value2 | cat2_value3 | ||||||
| when Category3 -selected: | column_name1 | |||||||
| result3 | Cat3_value1 |
Hi ismrdelj ,
Power BI doesn't support truly dynamic columns in table visuals where columns automatically hide if they contain only nulls. However, you can work around this by unpivoting your data in Power Query. In the Power Query Editor, select your value columns such as column_name1, column_name2, and column_name3, then right-click and choose "Unpivot Columns". This will transform your data into a format with three columns: Category, Column Name, and Column Value, where each row represents one value from the original wide format.
Once this is done, you can create a slicer in your report based on the Category column. Then, create a table visual using Column Name on rows and Column Value on values. To ensure that only non-null values appear, add a visual-level filter on Column Value and set it to "is not blank". This will effectively hide any rows (which correspond to your original columns) that had null values for the selected category.
Here's a simple example of what the unpivoted table will look like:
Category Column Name Column Value category1 column_name1 Cat1_value1 category1 column_name2 Cat1_value2 category1 column_name3 Cat1_value3 category2 column_name1 null category2 column_name2 Cat2_value2 category2 column_name3 Cat2_value3 category3 column_name1 Cat3_value1 category3 column_name2 null category3 column_name3 null This approach will allow your visual to dynamically adjust based on the selected category, effectively hiding columns that would otherwise be fully null.
Best regards,
6 Replies
- DataNinja777Super User
Hi ismrdelj ,
Power BI doesn't support truly dynamic columns in table visuals where columns automatically hide if they contain only nulls. However, you can work around this by unpivoting your data in Power Query. In the Power Query Editor, select your value columns such as column_name1, column_name2, and column_name3, then right-click and choose "Unpivot Columns". This will transform your data into a format with three columns: Category, Column Name, and Column Value, where each row represents one value from the original wide format.
Once this is done, you can create a slicer in your report based on the Category column. Then, create a table visual using Column Name on rows and Column Value on values. To ensure that only non-null values appear, add a visual-level filter on Column Value and set it to "is not blank". This will effectively hide any rows (which correspond to your original columns) that had null values for the selected category.
Here's a simple example of what the unpivoted table will look like:
Category Column Name Column Value category1 column_name1 Cat1_value1 category1 column_name2 Cat1_value2 category1 column_name3 Cat1_value3 category2 column_name1 null category2 column_name2 Cat2_value2 category2 column_name3 Cat2_value3 category3 column_name1 Cat3_value1 category3 column_name2 null category3 column_name3 null This approach will allow your visual to dynamically adjust based on the selected category, effectively hiding columns that would otherwise be fully null.
Best regards,
- v-sgandrathiCommunity Support
Hi ismrdelj,
Thank you for your patience, and I’m glad the explanation was helpful!
DataNinja777 You’re absolutely right, Power BI doesn’t natively support dynamic columns that hide automatically based on null values in table visuals. However, a great workaround is using Power Query’s unpivoting feature combined with a slicer and visual-level filtering. This method ensures that any null values are hidden, giving you a cleaner and more dynamic view of your data.
Glad I could assist! If this answer helped resolve your issue, please mark it as Accept as Solution and give us Kudos to guide others facing the same concern.
Thank you.
- v-sgandrathiCommunity Support
Hi ismrdelj
We wanted to follow up since we haven't heard back from you regarding our last response. We hope your issue has been resolved.
If my answer resolved your query, please mark it as "Accept Answer" and give Kudos if it was helpful.
If you need any further assistance, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!
- v-sgandrathiCommunity Support
Hi ismrdelj ,
We wanted to follow up since we haven't heard back from you regarding our last response. We hope your issue has been resolved.
If my answer resolved your query, please mark it as "Accept Answer" and give Kudos if it was helpful.
If you need any further assistance, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!
- PBIdashboardsPost Patron
The unpivot workaround works but has a significant tradeoff: it restructures your entire data model for a presentation requirement, which can break other visuals or measures that depend on the original wide format.
A cleaner approach for hiding null columns without touching the data model: use Field Parameters (introduced in Power BI May 2022). Create a Field Parameter with all your columns, then users select which columns to show via a slicer columns with no data are simply not selected. No unpivoting required.
If the requirement is for columns to auto-hide based on null values without user action, that's genuinely not supported natively in 2025 either. The closest real solution is a custom visual Flexa Tables on AppSource handles dynamic column visibility based on data presence, and lets users show/hide columns directly in the published report without going back to Desktop