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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
luisrossa8
Regular Visitor

Help with wrong totals in matrix

Hi,

In short my issue is I get wrong row and column total in a matrix if I use a measure to compute the value of the sales.

 

luisrossa8_0-1702589391097.png

 

The data table is on the left.

 

On the right the first matrix has the totals correct.

The second matrix is not computing the totals right.

In this second matrix I used a measure like:

TotalSalesModified = if(SELECTEDVALUE(Sales[Item])="a" && SELECTEDVALUE(Sales[Month])="jan" ,99, sum(Sales[Sales]))

In the first one:

TotalSales = sum(Sales[Sales])

 

Can you help ?

 

Thanks in advance.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @luisrossa8 

 

For your question, I have created the following table.

vjialongymsft_0-1702619115936.png

 

 

Your original matrix looks like this:

vjialongymsft_1-1702619115936.png

 

You can use the following dax function to get the effect you want

TotalSalesModified = 
SUMX(
    Sales, 
    IF(
        Sales[Item] = "aa" && Sales[Month] = "jan", 
        99, 
        Sales[Sales]
    )
)

vjialongymsft_2-1702619138613.png

 

 

 

 

Best Regards,

Jayleny

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

4 REPLIES 4
Anonymous
Not applicable

Hello @luisrossa8 

 

For your question, I have created the following table.

vjialongymsft_0-1702619115936.png

 

 

Your original matrix looks like this:

vjialongymsft_1-1702619115936.png

 

You can use the following dax function to get the effect you want

TotalSalesModified = 
SUMX(
    Sales, 
    IF(
        Sales[Item] = "aa" && Sales[Month] = "jan", 
        99, 
        Sales[Sales]
    )
)

vjialongymsft_2-1702619138613.png

 

 

 

 

Best Regards,

Jayleny

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

Hi,

Thank you for your DAX.

Works fine as expected.

Five stars !!!!

 

luisrossa8_0-1702639867095.png

 

Anonymous
Not applicable

@luisrossa8  You might need to use the SUMX and VALUES functions in your measure because of the aggregation measures do in the absense of those functions.

Alberto Ferrari explains it well here: https://youtu.be/6rgAkejrup8?si=b5wMMA8p3j2cR3pS

Thank you for your help.

I'll see, as your suggestion, what Alberto has to say.

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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