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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Matrix Total incorrect when collapsed

Hi All,

 

i have a table that looks like this:

LocationMaterialOrderOrder $StockInv$Work OrdersWorkOrder $Total
new YorkApples-1     -1
new YorkApples-5     -5
new YorkApples-25     -25
new YorkApples-70     -70
new YorkApples  10   10
new YorkApples    25 25
new YorkApples    25 25
new YorkApples    25 25
new YorkApples    25 25
new YorkApples-60     -60
new YorkApples-10     -10
new YorkApples    25 25
new YorkApples    25 25
new YorkApples    25 25
new YorkApples    25 25
New JerseyOranges  100   100
New JerseyOranges    25 25
New JerseyOranges    25 25
New JerseyOranges    25 25
New JerseyOranges    25 25
New JerseyOranges-10     -10
New JerseyOranges    25 25
        215
ChicagoGrapes-1000     -1000
ChicagoGrapes  750   750
ChicagoGrapes    100 100

 

im trying to enter it into powerbi with a matrix to tell me net inventory. that means if im negative in one material, it needs to be 0 because the materials are not interchangeable. (if i have -200 grapes, it doesnt take away from my oranges)

i have a measure called Sumloc that says 

if(sumx('table','table'[Total])<=0,0, sumx('table','table'[total]))

and a second measure that says
if(HASONEfilter('table'[Material]),[SumLoc],sumx('table',[total]))

the summary looks correct when the matrix is all the way expanded, but when i shrink it down to the location, the numbers are WAY too much.

what am i doing wrong?

3 REPLIES 3
sevenhills
Super User
Super User

I am not sure how the matrix looks like...

 

One thing I noticed is you are using HASONEFILTER, Try using "HASONEVALUE" and see if that fixes

Anonymous
Not applicable

i have tried both, i'm goign to try and sub out my dataset so i can post the pbix file with "Dummy data" since the actual data is confidential

 

Hi, @Anonymous 

 

If you're using measure in matrix, It's normal to have problems, because the context of the matrix is complex, it will change after folding, and the value of measure itself will change with the context. You need to formulate a specific measure for the matrix visual.

So can you share some sample data (not a matrix) and your desired result(in visual)? Then we can help you soon.

 

Best Regards,
Community Support Team _ Janey

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.