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 ,
I understood the requirements, but how do you end up with the result 26? What should 26 be?
Can you explain the result a little better?
Thank you and best regards
Denis
Ciao selimovd ,
33 is the sum of each line for the shipment 3523253 excluding the first line with material "69199001"
So basically the sum of column Pallet Number.
| Shipment | Material | Country Key | Pallet Number |
| 3523253 | 77200895 | Bulgaria | 1 |
| 3523253 | 77201310 | Bulgaria | 1 |
| 3523253 | 77200895 | Bulgaria | 3 |
| 3523253 | 77200895 | Bulgaria | 3 |
| 3523253 | 77199968 | Bulgaria | 2 |
| 3523253 | 77200895 | Bulgaria | 5 |
| 3523253 | 77199968 | Bulgaria | 11 |
| 3523253 | 77204562 | Bulgaria | 0 |
| 3523253 | 77200895 | Bulgaria | 0 |
| 3523253 | 77199968 | Bulgaria | 0 |
| 3523253 | 77204562 | Bulgaria | 7 |
- selimovd5 years agoMost Valuable Professional
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- PaulMcDk4 years agoFrequent Visitor
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 !