0

Conditional Distinct Count?

I have a scenario where I want to count the number of orders when a flag is set ( sometimes I want to count when set to zero, sometimes when <> 0 ).

 

Basically, count distinct order number where COUNTMEFLAG = 0 

 

I'm trying something like this:  

 

distinct(

    CASE(

        EDW_ENGRAVING.COUNTMETEST.COUNTMEFLAG <> 0,

        EDW_ENGRAVING.COUNTMETEST.ORDERNUMBER,

       ''

    ),

    groupby(

        EDW_ENGRAVING.COUNTMETEST.PRODUCT

    )

)

 

But it still counts the NULL  ( unless there's another way to force the CASE function to return a NULL - " , NULL" doesn't work.

 

Additional info:  Order number is non-unique and should not be visible in the insight ( i.e. no grouping by order number )  

 

Any ideas?

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • Status Answered
  • 1 mth agoLast active
  • 2Replies
  • 28Views
  • 2 Following

Product Announcement

Incorta 5 is now Generally Available