Forum Discussion

Marcox28's avatar
Marcox28
Icon for Helper II rankHelper II
8 years ago

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_IDTVE_IdArticoloTVE_PriceTVE_CodicePromozioneTVE_IDScontrino
18389683,954441
28549782,03    1
385087510    1
485357627,99    2
585357627,99    2
681020327,99    2
785357627,99    3
881020327,994444
984975710    4
108383662,99    4
118383662,99    4
128383662,99    5
138551442,49    5
148226733,59    5
1583517519    5
1683663423,92    5
1783426138,5    6
188343086,474447
198549632,03    8
208549662,03    8
218549672,03    8
228549602,73    8
2384783727,9    9
2483433014,974449
2581582319,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_IDTVE_IdArticoloTVE_PriceTVE_CodicePromozioneTVE_IDScontrino
18389683,954441
28549782,03    1
385087510    1
881020327,994444
984975710    4
108383662,99    4
118383662,99    4
188343086,474447
2384783727,9    9
2483433014,974449
2581582319,95    9

 

44 Replies

  • Anonymous's avatar
    Anonymous
    Not 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's avatar
      Marcox28
      Icon for Helper II rankHelper 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's avatar
        popov
        Icon for Resolver III rankResolver 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]
            )
        )