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
mngma0102
Frequent Visitor

Matrix Column Total - Summing each Row Value with a measure value

Hello,

I have a matrix showing forecasted vs purchased data. The Forecasted data is updated for each Forecast # however the Purchased data will be the same for each Forecast # since the time-range is the same and it is from the past.

 

The problem I am running into, is that I would like the for the Purchased Column to SUM each row value so the Grand Total  equals 463,646.  I would like to do this so I can get an acccurate % for the Purchased/Forecast column.


The Purchased column is using a imported measure which I am unable to change. 

 

mngma0102_2-1721084832611.png

Thank you in advance! 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@mngma0102 I am glad to help you.
Here are my tests:
Available observations
When the value of measure is put into the matrix, the aggregated value of the total row/column that comes with the matrix is affected by the function currently used for measure
When MAX is used, the final aggregated value of total is the maximum value from the measure [Purchased] calculation 93459

vjtianmsft_0-1721095547444.png

When the SUM function is used to modify the measure, the result of the total aggregated value is the total value of the measure sum 231823

vjtianmsft_1-1721095574390.png

So if you want to change only the value of the measure in the total column, while keeping the original measure calculation logic, you need to use the if function to determine the current matrix row hierarchy: if the rows are filtered by fields at different levels, different calculation logic is performed.
You can use the HASONEVALUE function or the isinscope function, their role in the matrix is similar.
measure:

 

M_Purchased = 
SWITCH(TRUE(),
HASONEVALUE(Tabelle1[C_Forecast #]),SUM(Tabelle1[C_Purchased]),
HASONEVALUE(Tabelle1[YearMonth]),MAX(Tabelle1[C_Purchased]),
SUM('Tabelle1'[C_Purchased])
)
M_Pur/For = DIVIDE('Tabelle1'[M_Purchased],[Forecasted],0) 

 

vjtianmsft_2-1721095629033.png

vjtianmsft_3-1721095636316.png
Here is my test data:

vjtianmsft_4-1721095658141.png

It should be noted that the above is my test data based on the screenshots you provided, you need to create a new measure based on the data in your actual environment, not directly use the measure I provided, because everyone's computing environment is inconsistent, and the measure will be affected by different computing environments to display different values.
Because everyone's computing environment is not the same, and the measure will be affected by different computing environment to display different values.
I hope you can write a measure that meets your needs soon.
If you can provide a .pbix file that does not contain sensitive data and share it on the forum via OneDirve, it will help solve your problem.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
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
Anonymous
Not applicable

Hi,@mngma0102 I am glad to help you.
Here are my tests:
Available observations
When the value of measure is put into the matrix, the aggregated value of the total row/column that comes with the matrix is affected by the function currently used for measure
When MAX is used, the final aggregated value of total is the maximum value from the measure [Purchased] calculation 93459

vjtianmsft_0-1721095547444.png

When the SUM function is used to modify the measure, the result of the total aggregated value is the total value of the measure sum 231823

vjtianmsft_1-1721095574390.png

So if you want to change only the value of the measure in the total column, while keeping the original measure calculation logic, you need to use the if function to determine the current matrix row hierarchy: if the rows are filtered by fields at different levels, different calculation logic is performed.
You can use the HASONEVALUE function or the isinscope function, their role in the matrix is similar.
measure:

 

M_Purchased = 
SWITCH(TRUE(),
HASONEVALUE(Tabelle1[C_Forecast #]),SUM(Tabelle1[C_Purchased]),
HASONEVALUE(Tabelle1[YearMonth]),MAX(Tabelle1[C_Purchased]),
SUM('Tabelle1'[C_Purchased])
)
M_Pur/For = DIVIDE('Tabelle1'[M_Purchased],[Forecasted],0) 

 

vjtianmsft_2-1721095629033.png

vjtianmsft_3-1721095636316.png
Here is my test data:

vjtianmsft_4-1721095658141.png

It should be noted that the above is my test data based on the screenshots you provided, you need to create a new measure based on the data in your actual environment, not directly use the measure I provided, because everyone's computing environment is inconsistent, and the measure will be affected by different computing environments to display different values.
Because everyone's computing environment is not the same, and the measure will be affected by different computing environment to display different values.
I hope you can write a measure that meets your needs soon.
If you can provide a .pbix file that does not contain sensitive data and share it on the forum via OneDirve, it will help solve your problem.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.