Forum Discussion
Dynamic Column Headers in Table Visual Based on JSON Data
- 6 months ago
In the image below, you'll need to add an index column to uniquely identify each row values in matrix are always aggregated.
Please see the attached pbix.
Hi Anonymous
Yes. It is achievable, but not 100% dynamically in the way you expect.
Power BI does NOT support truly dynamic column headers in a table visual based on row selection.
Columns must exist in the data model.
However, here is the correct architecture.
What You Want
When selecting QC ID:
- Visual 2 filters by that QC ID (Easy)
- Columns change based on JSON keys (Not directly supported)
Recommended Professional Approach
Step 1 — Normalize JSON (Best Practice)
Instead of expanding JSON into dynamic columns, transform it into key-value structure in Power Query:
Convert JSON to:
QC ID Attribute Value
1001 Length 50
1001 Width 20
1002 Color Red
This is the correct data modeling pattern.
Step 2 — Use Table Visual Like This
Put in Visual 2:
- Rows >>> Attribute
- Values >>> Value
Now when user clicks QC ID in Visual 1:
- Visual 2 filters automatically
- Only relevant attributes appear
- No blank columns
- Fully dynamic per record
Why Dynamic Columns Won’t Work
Power BI:
-
Cannot create/remove columns dynamically
-
Cannot change headers based on slicer
-
Visual schema is fixed at design time
Even calculation groups or DAX cannot dynamically add/remove columns.
=================================================================
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Jaywant Thorat | MCT | Data Analytics Coach
LinkedIn: https://www.linkedin.com/in/jaywantthorat/
Join #MissionPowerBIBharat: https://tinyurl.com/JoinMissionPowerBIBharat
#MissionPowerBIBharat
LIVE with Jaywant Thorat