3 Replies Latest reply: Oct 1, 2015 10:01 AM by Manish Kachhia RSS

    Count, IF and Distinct Query Syntax

    Karen Mujeyi


      Need scripting help with an Expression.  I need to count DISTINCT based on two fields, but now I need to add an IF as well.

       

      So, I need to count the number of DISTINCT events (defined by combination of IDKEY and ServiceDate) IF the POTCode is 23.

       

      So far, I have tried numerous combinations.  The following are a couple examples, but none of them work.  Can someone please help me with the syntax?

       

      IF(POTCode = '23', Count(DISTINCT IDKey& ServiceDate))  --- I get no results with this one.

       

       

      Count({$<POTCode={"23"}>}DISTINCT IDKey & ServiceDate) --The totals are not correct as it is still pulling other POT codes and repeat ServiceDates.

       

      Please help.