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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Dynamic Measure Header Naming in Matrix

I have several measures that have corresponding current year, last year, and two years ago measure counterparts.

Example: Sales, Sales CY, Sales LY, Sales LY-1

 

I have these in a matrix, but I the column headers in the matrix need to read: Sales 2022, Sales 2021, Sales 2020

 

Right now, I have them manually named, but I would like this to be dynamic so we see a seamless switch when the year changes instead of someone needing to go in and manually update. Any suggestions?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous create a table as below.

Mohan1029_0-1658330259082.png

Use the measure as

Metrix Measures = 
SWITCH(TRUE(),
SELECTEDVALUE(Metrix[Year]) = MAX(Metrix[Year]) && MAX(Metrix[Type]) = "CY",100, -- CY Value
SELECTEDVALUE(Metrix[Year]) = MAX(Metrix[Year]) && MAX(Metrix[Type]) = "PY",200, -- PY Value
SELECTEDVALUE(Metrix[Year]) = MAX(Metrix[Year]) && MAX(Metrix[Type]) = "PY-1",300 -- PY-1 Value
)

Mohan1029_1-1658330302534.png

Let me know if that helps.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Accept the solution if that works for you.

Anonymous
Not applicable

@Anonymous create a table as below.

Mohan1029_0-1658330259082.png

Use the measure as

Metrix Measures = 
SWITCH(TRUE(),
SELECTEDVALUE(Metrix[Year]) = MAX(Metrix[Year]) && MAX(Metrix[Type]) = "CY",100, -- CY Value
SELECTEDVALUE(Metrix[Year]) = MAX(Metrix[Year]) && MAX(Metrix[Type]) = "PY",200, -- PY Value
SELECTEDVALUE(Metrix[Year]) = MAX(Metrix[Year]) && MAX(Metrix[Type]) = "PY-1",300 -- PY-1 Value
)

Mohan1029_1-1658330302534.png

Let me know if that helps.

Anonymous
Not applicable

So this worked perfectly for the situation, but I do have a follow-up. I have several measures I have added to this table, but a couple of them are percentages. Is there a way to control the data types for specific columns instead of simply all of them?

Hi, have you found solution for this problem? I have the same issue

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

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