Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX Formula - Sum Question

Hello,   I am trying to sum up the total extended cost of our items.  I am unsure how to filter some of the results, however, and need help.   In the screenshot below, you can see that I've filte...
  • lbendlin's avatar
    lbendlin
    4 years ago

    Thank you for providing the sample data. That helps a lot with proposing a potential solution.

     

    Include =
    VAR a =
        SUMMARIZE (
            'Table',
            'Table'[MATERIAL TRANSACTION ITEM],
            'Table'[MATERIAL TRANSACTION LOCATION],
            "Issue", CALCULATE (SUM ( 'Table'[EXTENDED COST] ),'Table'[TRANS_TYPE] = "Issue/WIP Change"),
            "Ship", CALCULATE ( SUM ( 'Table'[EXTENDED COST] ), 'Table'[TRANS_TYPE] = "Ship" )
        )
    VAR b =
        ADDCOLUMNS ( a, "sm", IF ( [Issue] <> 0, [Issue], [Ship] ) )
    RETURN
        SUMX ( b, [sm] )

     

    see attached