Skip to main content
Solved

Aggregation function together with a dimension function input.

  • Apr 13, 2023 2:55 PM UTC
  • 2 replies
  • 263 views

Sum(CASE WHEN "ActivityTable"."Activity" = 'something'

THEN 1.0 ELSE NULL END) gives me the count when there is an entry "something" in the table.

My challange is following:

I need to count Distinct Case_ID, whenever "something" happens. It can happen more than 1 time for an Case_ID, so i need a PQL statement like:

CASE WHEN "ActivityTable"."Activity" = 'something'

THEN count (Distinct(Case_ID) ELSE NULL END, which is ofcourse not working like this.

Ideas and solutions are welcome. Thanks a lot

Best answer by Anonymous

Not sure if it is the same but:

 

COUNT(DISTINCT

CASE WHEN PROCESS EQUALS activity THEN _CASE_KEY

ELSE NULL

END

)

 

works for some similar situations.

 

HTH

View original

2 replies

  • Answer
  • Apr 13, 2023 3:34 PM UTC

Not sure if it is the same but:

 

COUNT(DISTINCT

CASE WHEN PROCESS EQUALS activity THEN _CASE_KEY

ELSE NULL

END

)

 

works for some similar situations.

 

HTH


  • Apr 13, 2023 4:22 PM UTC

Works like a charm...thanks a lot😀