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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Pricef1
Regular Visitor

Trying to figure out how to get a total for a specific date,code,and weight for that code?

I have been working on this for an hour. Yes, I am new to Power BI. I can't figure out how to get a total for a specific date, when we may run different product codes with different case weight allocated to that product code. I can get the slicers to filter by individual product codes, and it will give me a total for that particular code. I run into an issue when trying to see the total for the entire day, when we ran multiple products with different finished weight. I am using: 

Total Pounds = SUM('SC87 Pet Treats'[CaseCount])*AVERAGE('Codes and Weights'[Case Weight])
Like i stated that works great when selecting individual codes, but I need a daily total when each case count may have a different weight. Example:  Code: 97418 case weight: 18lbs. , Code: 97457 case weight: 3lbs. , Code: 97493 case weight 4.5lbs.
Date 3/2
Case Count: 97418 = 100cs Weight: 1800lbs.
Case Count: 97457 = 300cs Weight 900lbs.
Case Count: 97493 = 100cs Weight 450lbs. 
What I am seeing now for total for that date is: 26,775lbs. Which is incorrect. It is taking the average of all the case weights and populating that total. I need it to see each code, case weight for that code, and give me a total weight based on case count for each code and the corresponding finished weight for that code. Is this possible? 
1 ACCEPTED SOLUTION

Total Pounds = SUMX(VALUES('Codes and Weights'[Product Code]),CALCULATE(SUM('Codes and Weights'[Case Weight])*SUM('SC87 Pet Treats'[CaseCount])))
 
Used what you gave me and tweaked it just a little. This works now
 

View solution in original post

5 REPLIES 5
Pricef1
Regular Visitor

Product CodeCase CountCase Weight

97418

10018
974573003
974931004.5

I have set up a relationship with the two tables. So it is looking for Product Code and the Case weight for that code. I am trying to get a total weight without having to select each code using a slicer, then add the weights together to get a total. I am trying to get it to use the slicer by date, and give a total for that date. Right now it is giving me an average total weight when i only select date, based on the formula I have right now. Explination: Slicer date selected 3/2. Total weight I want to see should be: 3,150lbs. The weight I am seeing: 370.5lbs. because it is taking the average of the 3 codes case weight. 

Hope this helps:

Padycosmos_0-1677864196872.png

 

Total Pounds = SUMX(VALUES('Codes and Weights'[Product Code]),CALCULATE(SUM('Codes and Weights'[Case Weight])*SUM('SC87 Pet Treats'[CaseCount])))
 
Used what you gave me and tweaked it just a little. This works now
 

Pricef1_0-1677866015689.png

 

Greg_Deckler
Community Champion
Community Champion

@Pricef1 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, 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.

 

First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8



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...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors