Forum Discussion
Get column headers to dynamically fit to frame
- Anonymous2 years ago
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.