Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I wanted to see if the column headers in a matrix could be set to fit to a frame dynamically? The number of column headers depends on a slicer. I want the column headers to fill the frame of the matrix at all times.
Solved! Go to Solution.
Hi, @kaweckil
Based on your description, I've created the following sample data:
I've created the following measures:
Actuals1 = SUM(SalesData[Actuals])
Budgets1 = SUM(SalesData[Budgets])
Forecasts1 = SUM(SalesData[Forecasts])
Var_Act_vs_Fcst = [Actuals1] - [Forecasts1]
Var_Act_vs_Bud = [Actuals1] - [Budgets1]
To be able to dynamically change the matrix header based on the slicer selection, I created the following header table:
I use the following DAX expression to create a measure that toggles the measure for the corresponding matrix header:
MatrixValues =
SWITCH(
MAX(Mappings[TableHeaders]),
"Actual", [Actuals1],
"Budget", [Budgets1],
"Forecast", [Forecasts1],
"Var Act vs Fcst", [Var_Act_vs_Fcst],
"Var Act vs Bud", [Var_Act_vs_Bud]
)
I've created a matrix with these fields, and a slicer with the TableHeaders field:
When I select the corresponding title in the slicer, the title of the matrix also changes automatically:
I have provided the PBIX file used this time below for your reference. In addition, you can learn about the current method of dynamically switching matrix headers through the following link:
Solved: Dynamically changing matrix column headers based o... - Microsoft Fabric Community
Solved: Dynamic Column Names for Matrix Visual using Slice... - Microsoft Fabric Community
Dynamic Column Headers in Power BI Customize with Inforiver
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @kaweckil
Based on your description, I've created the following sample data:
I've created the following measures:
Actuals1 = SUM(SalesData[Actuals])
Budgets1 = SUM(SalesData[Budgets])
Forecasts1 = SUM(SalesData[Forecasts])
Var_Act_vs_Fcst = [Actuals1] - [Forecasts1]
Var_Act_vs_Bud = [Actuals1] - [Budgets1]
To be able to dynamically change the matrix header based on the slicer selection, I created the following header table:
I use the following DAX expression to create a measure that toggles the measure for the corresponding matrix header:
MatrixValues =
SWITCH(
MAX(Mappings[TableHeaders]),
"Actual", [Actuals1],
"Budget", [Budgets1],
"Forecast", [Forecasts1],
"Var Act vs Fcst", [Var_Act_vs_Fcst],
"Var Act vs Bud", [Var_Act_vs_Bud]
)
I've created a matrix with these fields, and a slicer with the TableHeaders field:
When I select the corresponding title in the slicer, the title of the matrix also changes automatically:
I have provided the PBIX file used this time below for your reference. In addition, you can learn about the current method of dynamically switching matrix headers through the following link:
Solved: Dynamically changing matrix column headers based o... - Microsoft Fabric Community
Solved: Dynamic Column Names for Matrix Visual using Slice... - Microsoft Fabric Community
Dynamic Column Headers in Power BI Customize with Inforiver
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.