Forum Discussion
Dynamic column header in table based on values in one field
I have a text field in a table that I’m displaying the count for. The column name is Details, and the data in this column is either Stationary or Mobile. I have a slicer for the same field to show the count of the two results (stationary vs mobile).
Stationary
Mobile
Stationary
Stationary
Mobile
Count: 3 when stationary is selected in slicer
Count: 2 when mobile is selected in slicer
How do I dynamically change the column header in my table instead of Details to be Count of Stationary or Count of Mobile?
Is there a way to do this without creating separate measures to count each stationary and mobile values?
5 Replies
- Soc3
Helper I
Hi Ritaf1983 ,
Thanks for your reply.
I have multiple values to include in the matrix and when I add those values, the column header gets bumped up a level.
I've changed the terms, Detail=Advanced Booking Status and Stationary/Mobile are Advanced Purchase and Not in Advance. How do I associate the dynamic column header with the Count value?
- Ritaf1983
Super User
Hi again
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- Ray_Minds
Solution Supplier
Hi Soc3
Yes, you can dynamically change the column header in Power BI without creating separate measures for counting Stationary and Mobile. You can achieve this using a Measure and a Field Parameter.
Steps:
- Create a Measure for Dynamic Column Header:
This measure will return "Count of Stationary" when "Stationary" is selected in the slicer and "Count of Mobile" when "Mobile" is selected.
2. Create a Measure for Count:
3. Add the Measures to Your Table Visual:Use DynamicColumnHeader as the column header.
Use CountSelected as the column values.
Since DynamicColumnHeader changes based on the slicer selection, the table will update dynamically.
When Mobile is selected:
When Stationary is selected:
Best regards,
Ray Minds
http://www.rayminds.com
https://www.linkedin.com/company/rayminds/If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.