Forum Discussion
SUM + DISTINCTCOUNT support
- 5 years ago
Hey PaulMcDk ,
thank you for the explanation, now it makes sense 😊
The following measure should give you the result you want:
Pallet Number NEW = CALCULATE( SUM( 'Table'[Pallet Number] ), LEFT( 'Table'[Material], 3 ) <> "691" && 'Table'[Country Key] = "Bulgaria" )And that's the result:
If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic
Hey PaulMcDk ,
thank you for the explanation, now it makes sense 😊
The following measure should give you the result you want:
Pallet Number NEW =
CALCULATE(
SUM( 'Table'[Pallet Number] ),
LEFT( 'Table'[Material], 3 ) <> "691" && 'Table'[Country Key] = "Bulgaria"
)
And that's the result:
Dear Selimovd,
how are you doing ?
I'm using the solution you suggested but i notice it has a limit (not depending on you).
Formula is fine if i want to count #pallet per shipment BUT if i add another dimension it is not working .
For istance:
| Table A - Shipment | ||
| Shipment | Material | BRAND |
| 123456 | 771….1 | TUNA |
| 123456 | 771….2 | TUNA |
| 123456 | 771….3 | SALMON |
| 123456 | 771….4 | SALMON |
| 234567 | 771….1 | TUNA |
| 234567 | 771….2 | TUNA |
| 234567 | 771….3 | SALMON |
| 234567 | 771….4 | SALMON |
| 345678 | 771….1 | TUNA |
| 345678 | 771….2 | TUNA |
| 345678 | 771….3 | SALMON |
| 345678 | 771….4 | SALMON |
| Table B - Pallet | ||
| Shipment | Material | Pallet |
| 123456 | 771….1 | 3 |
| 123456 | 771….2 | 5 |
| 123456 | 771….3 | 18 |
| 123456 | 771….4 | 7 |
| 234567 | 771….1 | 5 |
| 234567 | 771….2 | 9 |
| 234567 | 771….3 | 11 |
| 234567 | 771….4 | 14 |
| 345678 | 771….1 | 32 |
| 345678 | 771….2 | 1 |
| 345678 | 771….3 | 2 |
| 345678 | 771….4 | 5 |
the two tables are linked with a relation Many:Many via "Shipment" key .
Now, if i want to have a new table with:
BRAND PALLET #
TUNA
SALMON
The formula is counting the total number of shipment without considering the BRAND.
So the total (or subtotal) per BRAND is wrong .
Any idea ?
thank you !