Forum Discussion

LeahGJ's avatar
LeahGJ
Frequent Visitor
5 years ago
Solved

Sum only Unique Value for Invoice Number

Hi,    I have a dataset, with duplicate data because of multiple lines. I want to sum the value of the invoice amount paid. I used to be able to do same, by using the "line Districtuion Amount" col...
  • ERD's avatar
    ERD
    5 years ago

    LeahGJ ,

    you might need something like this:

    measure_Item =
    VAR currentInvNum = MAX ( T[Invoice Number] )
    VAR ItemLineType = "ITEM"
    RETURN
        CALCULATE (
            MAX ( T[Line Distribution Amount] ),
            FILTER (
                ALL ( T ),
                T[Invoice Number] = currentInvNum
                    && T[Line Type] = ItemLineType
            )
        )

    If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.