Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
cristianj
Helper IV
Helper IV

Using name of a selected date month in a values name displayed in a pivot

Hello 
i have this situation

cristianj_0-1713340231720.png

i need to compare 2 values for every 2 distinct selected month from the 2 slicers in the right

Now i use the 1 and 2 name, is there a chance to use not 1 or 2 , but the year and month of the selected value in the name in the pivot
which will dinamicaly change based of the selection? 
Basically i want to change Units int1 in Units 2024.01 or Units 2023January, and the name will change when i change the selection in slicer 1
Thank you

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @cristianj ,

 

As far as I know, Power BI doesn't support dynamic measure header or column header in matrix visual.

I think we can try to achieve your goal by transform your data model.

My Sample:

vrzhoumsft_1-1713428100164.png

Data model:

vrzhoumsft_2-1713428116571.png

Measure:

Measure = 
VAR _INT1 = SELECTEDVALUE('INT 1'[YearMonth])
VAR _INT2 = SELECTEDVALUE('INT 2'[YearMonth])
VAR _STEP1 = SWITCH(MAX('INT'[Value]) , "INT 1", IF(MAX('DimDate'[YearMonth]) = _INT1,CALCULATE(SUM('Table'[Column1]))), "INT 2", IF(MAX('DimDate'[YearMonth]) = _INT2,CALCULATE(SUM('Table'[Column1]))))
VAR _STEP2 = CALCULATE(SUM('Table'[Column1]),FILTER(ALLSELECTED(DimDate),DimDate[YearMonth] = _INT1))/ CALCULATE(SUM('Table'[Column1]),FILTER(ALLSELECTED(DimDate),DimDate[YearMonth] = _INT2))
VAR _STEP3 = IF(HASONEVALUE(DimDate[YearMonth]),_STEP1,_STEP2)
RETURN
_STEP3
IF(HASONEVALUE(DimDate[YearMonth]),"","0.00%;-0.00%;0.00%")

Result is as below

vrzhoumsft_0-1713428038044.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @cristianj ,

 

As far as I know, Power BI doesn't support dynamic measure header or column header in matrix visual.

I think we can try to achieve your goal by transform your data model.

My Sample:

vrzhoumsft_1-1713428100164.png

Data model:

vrzhoumsft_2-1713428116571.png

Measure:

Measure = 
VAR _INT1 = SELECTEDVALUE('INT 1'[YearMonth])
VAR _INT2 = SELECTEDVALUE('INT 2'[YearMonth])
VAR _STEP1 = SWITCH(MAX('INT'[Value]) , "INT 1", IF(MAX('DimDate'[YearMonth]) = _INT1,CALCULATE(SUM('Table'[Column1]))), "INT 2", IF(MAX('DimDate'[YearMonth]) = _INT2,CALCULATE(SUM('Table'[Column1]))))
VAR _STEP2 = CALCULATE(SUM('Table'[Column1]),FILTER(ALLSELECTED(DimDate),DimDate[YearMonth] = _INT1))/ CALCULATE(SUM('Table'[Column1]),FILTER(ALLSELECTED(DimDate),DimDate[YearMonth] = _INT2))
VAR _STEP3 = IF(HASONEVALUE(DimDate[YearMonth]),_STEP1,_STEP2)
RETURN
_STEP3
IF(HASONEVALUE(DimDate[YearMonth]),"","0.00%;-0.00%;0.00%")

Result is as below

vrzhoumsft_0-1713428038044.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.