Forum Discussion

InsightSeeker's avatar
InsightSeeker
Icon for Helper III rankHelper III
2 years ago
Solved

Assistance Required for Calculated Column in Invoice Table

I need to create a calculated column to determine the total Invoice Amount for all sales within each invoice.   The calculated column should display the total Invoice Amount only for the first sale...
  • _AAndrade's avatar
    2 years ago

    Hi InsightSeeker,

     

    Here is my solution:

    Inv_Amount = 
    VAR CurInvNum = 'Table'[Inv_No]
    VAR TotInvAmnt = 
        CALCULATE(
            SUM('Table'[Sale_Amount]),
            FILTER('Table', 'Table'[Inv_No] = CurInvNum)
        )
    VAR FirstSaleCheck = 
        CALCULATE(
            MIN('Table'[Unique_Key]),
            FILTER('Table', 'Table'[Inv_No] = CurInvNum)
        )
    RETURN 
        IF('Table'[Unique_Key] = FirstSaleCheck, TotInvAmnt, 0)


    Final Output: