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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
domden
New Member

Total SUM in Matrix wrong

Hello there! I hope you guys can help me.

I have a problem with the total sum under my matrix in pbi.

 

I got 2 different ordernumbers. Order 1 has 4 order items; Order 2 has 1 item.

In Order 1, I get 23 subitems. thats why my warehouse software is duplicating the order items. (see below)

total_sum_Pbi_2.png

 

I want to know how many Items are in each order. Im using distinct count.

The count is correkt, but the total is wrong. (see below)

 

total_sum_Pbi.png

 

I have searched a lot now, but didnt find something useful.

Pls help 🙂

thx.

1 ACCEPTED SOLUTION
BITomS
Solution Supplier
Solution Supplier

Hi @domden,

 

To achieve this, you can use one measure that uses a variable to summarize the data. Help on variables here: https://docs.microsoft.com/en-us/dax/best-practices/dax-variables

 

Measure = VAR _Tbl = SUMMARIZE('TableName',[OrderNumber],"Count",DISTINCTCOUNT([OrderItem]))

RETURN

sumx(_Tbl,[Count])

 

The variable is doing the distinct count per category in a table and then the sumx is referencing the variable table to sum the distinct counts together. Hope this helps!

View solution in original post

1 REPLY 1
BITomS
Solution Supplier
Solution Supplier

Hi @domden,

 

To achieve this, you can use one measure that uses a variable to summarize the data. Help on variables here: https://docs.microsoft.com/en-us/dax/best-practices/dax-variables

 

Measure = VAR _Tbl = SUMMARIZE('TableName',[OrderNumber],"Count",DISTINCTCOUNT([OrderItem]))

RETURN

sumx(_Tbl,[Count])

 

The variable is doing the distinct count per category in a table and then the sumx is referencing the variable table to sum the distinct counts together. Hope this helps!

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

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.