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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.