Forum Discussion

JuanPabloCarr's avatar
JuanPabloCarr
New Member
3 years ago
Solved

distinct add with repeated values

Hi, i got the following problem:

We have purchase orders for materials, these are received little by little by the suppliers, so repeated rows of the same order are created as the materials are received as follows:

|Purchase order|

|product|

|quantity order|

|recibed|

|money|

1

wood

30

10

100$

1

wood

30

20

100$

2

door

20

20

50$

3

window

15

10

300$

3

window

15

5

300$


How can I sum the amount of money without repeating the amounts depending on the purchase order?

6 Replies

  • hi JuanPabloCarr 

    try like:

    Measure =
    VAR _table =
    ADDCOLUMNS(
       VALUES(TableName[Purchase order]),
       "Money",
       CALCULATE(MAX(TableName[Money]))
    )
    RETURN
    SUMX(_table, [Money])
    • JuanPabloCarr's avatar
      JuanPabloCarr
      New Member

      it isnt working, the code return the same value as if i sum all the values of the column "Money", counting the repeated ones

    • JuanPabloCarr's avatar
      JuanPabloCarr
      New Member

      i need a measure to sum 450 (1wood + 1door + 1windows) and not 850 (2wood + 1door +2windows)

      • smpa01's avatar
        smpa01
        Community Champion

        JuanPabloCarr 

        Measure = CALCULATE(SUMX(VALUES(tbl[|money|]),tbl[|money|]),ALL(tbl))