Sum with multiple conditions

Options

New to Domo and having trouble setting up a calculated field. I have a column "Quantity" I need to sum up if column "product code number" value is 83 and column "units" value is SF.

Best Answer

  • david_cunningham
    Answer ✓
    Options
    SUM(CASE WHEN product code number= 83 and units= 'SF' then Quantity END)
    

    @Mvolkmann - here you go. You can use what's called a case statement to return quantity when those conditions are met, and then sum the results.

    David Cunningham

    ** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
    ** Did this solve your problem? Accept it as a solution! ✔️**

Answers

  • david_cunningham
    Answer ✓
    Options
    SUM(CASE WHEN product code number= 83 and units= 'SF' then Quantity END)
    

    @Mvolkmann - here you go. You can use what's called a case statement to return quantity when those conditions are met, and then sum the results.

    David Cunningham

    ** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
    ** Did this solve your problem? Accept it as a solution! ✔️**