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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

I need to attach a new column to the matrix visualization.

Hi,

 

I'm very new to this community, Please help me out here. My task is to create a matrix visualization every week and get the total counts. I want to have this total count column to get attached to next week's matrix visualization as naming the previous week's total and I need to create a new column that has the difference between the Total and the previous week's total. The rows should match the previous week's total and new total columns in the matrix visualization.

 

Thanks

Govind Daga

1 ACCEPTED SOLUTION

Hi @Anonymous ,

In Power BI, Matrix visual is not the same with it in Excel. Matrix visual has three fileds, Rows, Columns and Values.

vkalyjmsft_0-1664259046069.png

The Grand total column can easily get by turning on the total option in the format pane. But if you want to get the below result in a matrix in Power BI, it's going to be a big change to the data model. Values in the red box should be in a column placed in Rows in matrix visual, values in the green box should be in a column placed in Columns in matrix visual, and all the values in yellow box can be a column or measure placed in Values in matrix.

vkalyjmsft_1-1664259174111.png

So if your sample is not in this format, you should first modify it in Power Query or create a new table manually like this:

vkalyjmsft_2-1664260727121.png

In this sample, put domain in Rows, Column1 and Column2 in Columns.

vkalyjmsft_3-1664260965902.png

For the Values part of the matrix, create a measure manually calculate its value according to the Columns by the SWITCH function like this:

Measure =
SWITCH (
    MAX ( 'Table'[Column1] ),
    "Within KPI", 1,
    "Grand Total", 2,
    "Previous Week", 3
)

The 1, 2, 3 in the formula is just an example, it should be calculated based on the corresponding value in the fact table.

 

Best Regards,
Community Support Team _ kalyj

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

7 REPLIES 7
Anonymous
Not applicable

@v-yanjiang-msft  Will this work with the pivot table / Matrix Visualization? Because I need to match the rows of this week with the previous week's rows too.

Hi @Anonymous ,

Sorry I'm not very clear about your expected result "match the rows of this week with the previous week's rows". Could you please give a simple example about your expected result? You can show it in an Excel or something else.

 

Best Regards,
Community Support Team _ kalyj

Anonymous
Not applicable

app_automatiom_1-1664250582282.png

@v-yanjiang-msftHere is the resulting image that I want to have. The previous week may or may not have certain alphabets, for example, if you see under production in 'k' we don't have it in the previous week so that's the reason we put blank(-). I'm creating a pivot table on the power bi but am unable to join the previous week's total with the current week's total. 

 

Can I create a measure in pivot table/matrix visualization in PowerBI? If yes what should the DAX for it be?
Note: Previous week and Difference are being done manually.

Thanks for your reply. Appreciate it.

Hi @Anonymous ,

In Power BI, Matrix visual is not the same with it in Excel. Matrix visual has three fileds, Rows, Columns and Values.

vkalyjmsft_0-1664259046069.png

The Grand total column can easily get by turning on the total option in the format pane. But if you want to get the below result in a matrix in Power BI, it's going to be a big change to the data model. Values in the red box should be in a column placed in Rows in matrix visual, values in the green box should be in a column placed in Columns in matrix visual, and all the values in yellow box can be a column or measure placed in Values in matrix.

vkalyjmsft_1-1664259174111.png

So if your sample is not in this format, you should first modify it in Power Query or create a new table manually like this:

vkalyjmsft_2-1664260727121.png

In this sample, put domain in Rows, Column1 and Column2 in Columns.

vkalyjmsft_3-1664260965902.png

For the Values part of the matrix, create a measure manually calculate its value according to the Columns by the SWITCH function like this:

Measure =
SWITCH (
    MAX ( 'Table'[Column1] ),
    "Within KPI", 1,
    "Grand Total", 2,
    "Previous Week", 3
)

The 1, 2, 3 in the formula is just an example, it should be calculated based on the corresponding value in the fact table.

 

Best Regards,
Community Support Team _ kalyj

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

Anonymous
Not applicable

Hi @v-yanjiang-msft , I got the columns until the grand total in Power BI too, but my challenge is to get the previous week's total and attach it beside the current week's Grand Total value and of course also the difference.

Hi @Anonymous ,

I know you can get the grand total, the workaroud I mentioned in the previous post is how to get the previous week's total in the same visual. By default, it can't be achieved, you need to create a new table to get the expected result.

 

Best Regards,
Community Support Team _ kalyj

v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample.

vkalyjmsft_0-1663747671785.png

Based on the sample, I create a matrix like below, put the Week column in a slicer and put Week and Sales column in a matrix.

vkalyjmsft_1-1663747756766.png

Create two measures.

PreviousWeek =
CALCULATE ( SUM ( 'Table'[Sales] ), 'Table'[Week] = MAX ( 'Table'[Week] ) - 1 )
Diff = SUM('Table'[Sales])-[PreviousWeek]

Get the result:

vkalyjmsft_2-1663747901447.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors