3 Replies Latest reply: Dec 11, 2015 5:42 PM by Sunny Talwar RSS

    Sum IF with Distinct

    Karen Mujeyi

      I have the following columns of data:

       

      1) Customer_ID

      2) Service_Date

      3) Service_Count

      4) Location_Code

      5) Service_ID

       

      I need to add the Service_Count for Customer_IDs with DISTINCT Customer_ID & Service_Date, IF the Location_Code is 23.

       

      How can I write an expression for this?

       

      I originally had

       

      Sum( If( Location_Code = '23', Service_Count, ))

       

      Obviously this is incorrect, but did not know how to add the DISTINCT clause.

       

      Any help is greatly appreciated.