Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

how to create dynamic multiple column name in matrix?

Hi experts, I created a multiple dimension matrix, my solution is first created in dimension table and then use the switch true DAX get the revelent measure:

1.dimension table I created:

2.measure I created:

cal_amount=
SWITCH(SELECTEDVALUE(dim_2Y[num]),
1,IF(ISBLANK([cal_amount_FYTD_PreviousM_FY-1]),"-",[cal_amount_FYTD_PreviousM_FY-1]),
2,[cal_amount_FYTD_PreviousM_Increase%_Y-1],
3,[cal_amount_FYTD_PreviousM],
4,[cal_amount_FYTD_PreviousM_Increase%_Y])

3.here is the result:

4. as can be seen above, the column name of year_name just come from dimen table and can not be changed, so how to get the dynamic column name based on slicer? for example, when selected FY24, then the column name of year_name keeps two value FY24, FY23, or 24,23




but the problem is that when selected the year, the year name is remained the same, so how to get the dynamic column name based on the slicer?

  • Anonymous  there's no way to change the column name dynamically. You can change it to a . so that 'year_name' doesn't display on your matrix. You can also use the 'Title' of the matrix or the 'subtitle' of the matrix (in the formatting for the matrix) to display the Years selected in your slicer. 

     

    To do that, click on the 'fx' in the title or subtitle formatting, then add a measure. Try a measue such as: 

    [fx Matrix Title selected Years] = CONCATENATEX ( VALUES( TableName[YearColumnNameUsedInSlicer] ), TableName[YearColumnNameUsedInSlicer] , ", " )

     

     

1 Reply

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    Anonymous  there's no way to change the column name dynamically. You can change it to a . so that 'year_name' doesn't display on your matrix. You can also use the 'Title' of the matrix or the 'subtitle' of the matrix (in the formatting for the matrix) to display the Years selected in your slicer. 

     

    To do that, click on the 'fx' in the title or subtitle formatting, then add a measure. Try a measue such as: 

    [fx Matrix Title selected Years] = CONCATENATEX ( VALUES( TableName[YearColumnNameUsedInSlicer] ), TableName[YearColumnNameUsedInSlicer] , ", " )