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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

DAX command to sum individual sites in a matrix?

Hello,

 

I have the following matix. I am trying to create a column which shows the total amount of a specific product produced at the Ship To location. In this case MEH and OX.

 

The SKU column shows the quantity that has been shipped from Cape to the respective site. In the "Site Produces" column I want to display specifically how much the respective Ship To location produces of the SKU. The way I have it showing in the image below is by using the Calculate function to filter by the site OX. 

 

The function is as follows: 

 

OX Produces = CALCULATE ( SUM ( 'table'[SKU_quantity] ), ALLEXCEPT('table','table'[prod_name]), 'table'[Ship To] = "OX")

 

 

This does what I need but only for the OX site. Is it possible to have this function change within the matrix for each specific Ship To location, for example, when I expand to MEH, I will see the "Site Produces" value for MEH?

 

 Matrix.jpg

 

Thanks in advance!

5 REPLIES 5
Anonymous
Not applicable

[Measure] =
CALCULATE (
SUM ( 'table'[SKU_quantity] ),
VALUES( 'table'[prod_name] ),
VALUES( 'table'[Ship To] )
ALL('table' )
)
Greg_Deckler
Community Champion
Community Champion

@Anonymous - So normally you would create a VAR __shipto = MAX('Table'[Ship to]) and you would use that in your filter.

 

If that does not help, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  Is this supposed to be a filter in the CALCULATE function?

 

I tried the follwing:

_Site Produces = CALCULATE (SUM('table'[SKU_quantity]),ALLEXCEPT('table','table'[prod_name]),[_Var_ShipTo]) 

 

This gives me the error "A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed." 

@Anonymous - I guess I was thinking:

 

OX Produces = CALCULATE ( SUM ( 'table'[SKU_quantity] ), ALLEXCEPT('table','table'[prod_name]), 'table'[Ship To] = Var_Ship_To)

 

I don't tend to use CALCULATE



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Anonymous ,

 

See if this works.

 

Produces = CALCULATE ( SUM ( 'table'[SKU_quantity] ), ALLEXCEPT('table','table'[prod_name])

 

The filter context should work for each shipto site.

 

Regards,

Harsh Nathani 

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.