Forum Discussion
Dynamic Column Selection in a Table Visual
- 8 months ago
Hi mohit01chugh,
Thank you for sharing the screenshots. This behavior is expected, Power BI retains a column and its header in the visual even if all its cells are blank, so hiding values won’t remove the Sale header.
To address this, you have three options:
1.Use Field Parameters (recommended) by creating a parameter with Stock and Sale fields, adding it to your Table or Matrix, and controlling it with a slicer so only the selected field appears;
2.Unpivot the Stock and Sale columns in Power Query, then use the Attribute field in a Matrix and control which attributes display with a slicer; 3.Set up separate visuals for Stock-only, Sale-only, and both, then toggle between them using a slicer and bookmarks.
Field Parameters offer the best user experience, unpivoting is most model-friendly, and bookmarks are a straightforward alternative.
Thank you.
mohit01chugh,
What is the exact structure in which data is pulled? In your screenshot, Stock and Sale are merged columns which is not possible, hence asking about the exact structure of data.
Nevertheless, you can always use bookmarks but if data is structured correctly, you can simply a matric visual and use slicer.
Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!! Proud To Be a Super User !!! |
- mohit01chugh8 months agoFrequent Visitor
Thanks for the follow-up. Apologies for the delayed response.
Refer to the Input data and Expected Output.I tried with a solution, where "Stock" is selected: Show the two relevant Stock columns, and the Sale relevant values are blank, that's okay, but the Sale header is still reflected in the table