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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
RDHR
Frequent Visitor

matrix table to show different values for different column value (year)

Hi guys, I want to create a matrix table like below

For the previous two years, I wanna show the same values(A,B,V,%C)

For the current year, I wanna show the A,%C plus additional two or more different values(E,F..)

 

Is it possible to achieve this in one matrix table? Thanks!

2.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @RDHR ,

I created some data:

vyangliumsft_0-1693805551171.png

 

There are two methods here, but both of them will affect the data structure and presentation to a greater or lesser extent because of the design of Power BI.

Here are the steps you can follow:

 

First method:

Create measure all put into the Value of the matrix, but the matrix does not automatically hide the value of Value= blank, we need to manually operate:

1. Create measure.

A1 = MAX('Table'[A])
B1 =
IF(
    MAX('Table'[Year])<>2023,MAX('Table'[B]),BLANK())
C1 =
MAX('Table'[%C])
E1 =
IF(
    MAX('Table'[Year])=2023,MAX('Table'[E]),BLANK())
F1 =
IF(
    MAX('Table'[Year])=2023,MAX('Table'[F]),BLANK())
V1 =
IF(
    MAX('Table'[Year])<>2023,MAX('Table'[V]),BLANK())

vyangliumsft_1-1693805551177.png

2. Move the mouse over the column for each blank value, reducing the width of the column to make it invisible to the naked eye

vyangliumsft_2-1693805643306.png

3. Result:

vyangliumsft_3-1693805643309.png

Second method:

Use Power Quer to change the data structure, put the column with values into a column, use Measure to judge, but the data is in one column, the data structure in the same column must be the same.

1. In power query – select [A]—[F] – Transform –Unpivot Columns.

vyangliumsft_4-1693805665871.png

vyangliumsft_5-1693805665873.png

2. Create measure:

Measure =
SWITCH(
    TRUE(),
    MAX('Table (2)'[Year])=2021&&MAX('Table (2)'[Attribute]) in
    {"A","B","V","%C"},MAX('Table (2)'[Value]),
    MAX('Table (2)'[Year])=2022&&MAX('Table (2)'[Attribute]) in
    {"A","B","V","%C"},MAX('Table (2)'[Value]),
    MAX('Table (2)'[Year])=2023&&MAX('Table (2)'[Attribute]) in
    {"A","%C","E","F"},MAX('Table (2)'[Value]),BLANK())

vyangliumsft_6-1693805695718.png

 

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

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @RDHR ,

I created some data:

vyangliumsft_0-1693805551171.png

 

There are two methods here, but both of them will affect the data structure and presentation to a greater or lesser extent because of the design of Power BI.

Here are the steps you can follow:

 

First method:

Create measure all put into the Value of the matrix, but the matrix does not automatically hide the value of Value= blank, we need to manually operate:

1. Create measure.

A1 = MAX('Table'[A])
B1 =
IF(
    MAX('Table'[Year])<>2023,MAX('Table'[B]),BLANK())
C1 =
MAX('Table'[%C])
E1 =
IF(
    MAX('Table'[Year])=2023,MAX('Table'[E]),BLANK())
F1 =
IF(
    MAX('Table'[Year])=2023,MAX('Table'[F]),BLANK())
V1 =
IF(
    MAX('Table'[Year])<>2023,MAX('Table'[V]),BLANK())

vyangliumsft_1-1693805551177.png

2. Move the mouse over the column for each blank value, reducing the width of the column to make it invisible to the naked eye

vyangliumsft_2-1693805643306.png

3. Result:

vyangliumsft_3-1693805643309.png

Second method:

Use Power Quer to change the data structure, put the column with values into a column, use Measure to judge, but the data is in one column, the data structure in the same column must be the same.

1. In power query – select [A]—[F] – Transform –Unpivot Columns.

vyangliumsft_4-1693805665871.png

vyangliumsft_5-1693805665873.png

2. Create measure:

Measure =
SWITCH(
    TRUE(),
    MAX('Table (2)'[Year])=2021&&MAX('Table (2)'[Attribute]) in
    {"A","B","V","%C"},MAX('Table (2)'[Value]),
    MAX('Table (2)'[Year])=2022&&MAX('Table (2)'[Attribute]) in
    {"A","B","V","%C"},MAX('Table (2)'[Value]),
    MAX('Table (2)'[Year])=2023&&MAX('Table (2)'[Attribute]) in
    {"A","%C","E","F"},MAX('Table (2)'[Value]),BLANK())

vyangliumsft_6-1693805695718.png

 

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

 

Thank you so much, Liu! This is extremely helpful. Much appreciated. 

 

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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