The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Experts,
I have a table like below:
Shipment Number | Material Number | Distance | Item Weight |
S1 | M001 | 100 | 10 |
S1 | M002 | 100 | 10 |
S1 | M003 | 100 | 10 |
S2 | M004 | 200 | 10 |
S2 | M005 | 200 | 50 |
S3 | M006 | 300 | 10 |
S3 | M007 | 300 | 10 |
S3 | M008 | 300 | 50 |
S4 | M009 | 400 | 80 |
S5 | M010 | 500 | 10 |
S5 | M011 | 500 | 10 |
Each shipment can have multiple materials.
We need DAX to calculate the following measures:
If someone can help with the DAX, it would be very helpful.
Thanks
You can use
Total distance covered =
SUMX (
SUMMARIZE ( 'Table', 'Table'[Shipment number], 'Table'[Distance] ),
'Table'[Distance]
)
Total Weight = SUM( 'Table'[Item Weight])
Total Weight/KM = DIVIDE( [Total Weight], [Total distance covered])
Hi, The SUMX function does not accept a field as its 3rd argument. We need an aggregated value there. Can you help us?
There isn't a third argument to SUMX, I think you may have a typo in your code. Double check it against what I posted.
User | Count |
---|---|
11 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
22 | |
14 | |
14 | |
9 | |
7 |