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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Matrix different value for different columns (years)

I have a Matrix - the columns are months/years

For 1 year I want the value to be 1 field and for another year I want the value to come from a different field.

I have tried having 2 seperate matrix's next to each other which is OK. But there are quite a few rows so doesn't look good when you scroll one of them.

It would be better if they were both in the same matrix

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous maybe write a measure, something like this:

 

New Measure = 
IF ( SELECTEDVALUE ( Table[Year] ) = 2022, [Some Measure], [Otherwise This Measure] )

 

and use the above measure in the matrix visual.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1661395993155.png

Here are the steps you can follow:

1. Power Query – Choose[AmountA],[AmountB] – Unpivot Columns.

vyangliumsft_1-1661395993164.png

2. Create calculated column.

months/years = YEAR('Table'[Date])

vyangliumsft_2-1661395993165.png

3. Create measure.

Flag =
SWITCH(
    TRUE(),
    MAX('Table'[months/years])=2021&&MAX('Table'[Attribute])="AmountA",1,
    MAX('Table'[months/years])=2022&&MAX('Table'[Attribute])="AmountB",1,    
    0)

4. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_3-1661395993166.png

5. Result:

vyangliumsft_4-1661395993171.png

If you need pbix, please click here.

Matrix different value for different columns (years).pbix

 

Best Regards,

Liu Yang

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

parry2k
Super User
Super User

@Anonymous maybe write a measure, something like this:

 

New Measure = 
IF ( SELECTEDVALUE ( Table[Year] ) = 2022, [Some Measure], [Otherwise This Measure] )

 

and use the above measure in the matrix visual.

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors