Forum Discussion

ofi2023's avatar
ofi2023
Regular Visitor
2 years ago
Solved

SUMIFS DAX Equivalent

I'm new to PowerBI and DAX and I've been stuck trying to creating a measure to sum the Amount column if the Status is either "OK to Pay" or "Paid". In excel, I would use the =SUM(SUMIFS(Education Award Payments'!F:F,'Education Award Payments'!E:E,Sheet1!E6,'Education Award Payments'!G:G,Sheet1!$I$5:$J$5)) forumla to get the values for each participant, but I'm just not sure what the DAX formula would be to get the same results. 

 

Column E        Column F      Column G

NameAmountStatus
Participant 1$1,126.00OK to Pay
Pasrticipant 1$76.95Hold
Participant 1$750.00Paid
Participant 2$690.00Cancel
Participant 2$89.25OK to Pay
Participant 3$157.93OK to Pay

 

 

  • Any of the following would work...

    Sum1 = 
    SUMX(
        FILTER('Table', 'Table'[Status] IN {"OK to Pay", "Paid"}),
        'Table'[Amount]
    )
    Sum2 = 
    SUMX(
        FILTER('Table', 'Table'[Status] = "OK to Pay" || 'Table'[Status] = "Paid"),
        'Table'[Amount]
    )
    Sum3 = 
    CALCULATE(
        SUM('Table'[Amount]),
        OR('Table'[Status] = "Ok to Pay", 'Table'[Status] = "Paid")
    )

5 Replies

  • Any of the following would work...

    Sum1 = 
    SUMX(
        FILTER('Table', 'Table'[Status] IN {"OK to Pay", "Paid"}),
        'Table'[Amount]
    )
    Sum2 = 
    SUMX(
        FILTER('Table', 'Table'[Status] = "OK to Pay" || 'Table'[Status] = "Paid"),
        'Table'[Amount]
    )
    Sum3 = 
    CALCULATE(
        SUM('Table'[Amount]),
        OR('Table'[Status] = "Ok to Pay", 'Table'[Status] = "Paid")
    )
    • ofi2023's avatar
      ofi2023
      Regular Visitor

      Thank you so much! This is exactly what I was looking for.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ofi2023 ,

     

    Your solution is great, ryan_mayu  / jgeddes . It worked like a charm! Here I have another idea in mind, and I would like to share it for reference.

     

    Please try:

     

    Create a measure:

    Total Amount = SUMX(
        CALCULATETABLE(
            'Table',
            'Table'[Status] IN {"OK to Pay", "Paid"}
        ),
        'Table'[Amount]
    )

     

    In the final page the effect is shown below:

     

    The pbix file is attached.

     

    If you have any other questions please feel free to contact me.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    • ofi2023's avatar
      ofi2023
      Regular Visitor

      This is a great alternative! It wasn't exactly what I was looking for since it separated the status instead of combining them but this will be useful for other situations.