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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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