The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
Solved! Go to Solution.
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,
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.
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!
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!
Hi @ismrdelj ,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Thank you.
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,