Forum Discussion
SUM SALES WITH PROMO
I have a problem in calculating sales made with receipts with at least one product being promoted.
my sales table is
| TVE_ID | TVE_IdArticolo | TVE_Price | TVE_CodicePromozione | TVE_IDScontrino |
| 1 | 838968 | 3,95 | 444 | 1 |
| 2 | 854978 | 2,03 | 1 | |
| 3 | 850875 | 10 | 1 | |
| 4 | 853576 | 27,99 | 2 | |
| 5 | 853576 | 27,99 | 2 | |
| 6 | 810203 | 27,99 | 2 | |
| 7 | 853576 | 27,99 | 3 | |
| 8 | 810203 | 27,99 | 444 | 4 |
| 9 | 849757 | 10 | 4 | |
| 10 | 838366 | 2,99 | 4 | |
| 11 | 838366 | 2,99 | 4 | |
| 12 | 838366 | 2,99 | 5 | |
| 13 | 855144 | 2,49 | 5 | |
| 14 | 822673 | 3,59 | 5 | |
| 15 | 835175 | 19 | 5 | |
| 16 | 836634 | 23,92 | 5 | |
| 17 | 834261 | 38,5 | 6 | |
| 18 | 834308 | 6,47 | 444 | 7 |
| 19 | 854963 | 2,03 | 8 | |
| 20 | 854966 | 2,03 | 8 | |
| 21 | 854967 | 2,03 | 8 | |
| 22 | 854960 | 2,73 | 8 | |
| 23 | 847837 | 27,9 | 9 | |
| 24 | 834330 | 14,97 | 444 | 9 |
| 25 | 815823 | 19,95 | 9 |
where is it
TVE_ID indicates sales line ID
TVE_price indicates the selling price
TVE_codicepromo indicates the code of the promotion
TVE_IDScontrino indicates the receipt number.
How can I calculate the sum of all receipts that contain at least one product in promotion 444?
I expect this result to come: promotional sales = 129.24
because it sum the following sales line
| TVE_ID | TVE_IdArticolo | TVE_Price | TVE_CodicePromozione | TVE_IDScontrino |
| 1 | 838968 | 3,95 | 444 | 1 |
| 2 | 854978 | 2,03 | 1 | |
| 3 | 850875 | 10 | 1 | |
| 8 | 810203 | 27,99 | 444 | 4 |
| 9 | 849757 | 10 | 4 | |
| 10 | 838366 | 2,99 | 4 | |
| 11 | 838366 | 2,99 | 4 | |
| 18 | 834308 | 6,47 | 444 | 7 |
| 23 | 847837 | 27,9 | 9 | |
| 24 | 834330 | 14,97 | 444 | 9 |
| 25 | 815823 | 19,95 | 9 |
44 Replies
- AnonymousNot applicable
I'm confused. I see only four lines coded to the promo and they do not add over $100. If there is no code in the lines I do not know how to pull those out.
- Marcox28
Helper II
yes, four lines that are part of 4 receipts containing, in some cases also products not sold in promotion. I would also like to add those lines as you can see from the second table.
the sales lines are part of the same receipt if they have the same TVE_IDScontrino
- popov
Resolver III
Hello, Anonymous
If i correct understud your case, i hope formula below help you.Promotional sales =
CALCULATE (
SUM ( SalesTable[TVE_price] ),
SUMMARIZE (
FILTER ( SalesTable, NOT ISBLANK ( SalesTable[TVE_codicepromo] ) ),
SalesTable[TVE_IDScontrino]
)
)