Skip to main content
Question

Count greater than

  • March 1, 2023
  • 5 replies
  • 4 views

rene.szere
Level 2

Hi,

 

i am just starting to familiarise myself with Celonis and have started with the Celonis Academy. 

Now I have a simple question. 

 

Currently I have this formula: COUNT(DISTINCT "OCH_Cases". "Party_Request_KEY")

I want only values greater than 2 to be displayed.

 

What should the formula look like then?

 

Best regards

Rene

5 replies

Depends. If you can use it with a component filter, then it will be FILTER COUNT(DISTINCT "OCH_Cases". "Party_Request_KEY") > 2

 

If you want to use it as a KPI or Dimension like in a OLAP and you can't use a filter, then a CASE WHEN will do

 

CASE WHEN COUNT(DISTINCT "OCH_Cases". "Party_Request_KEY") > 2 then COUNT(DISTINCT "OCH_Cases". "Party_Request_KEY") else 0 END (or something like that)

 

HTH


rene.szere
Level 2
  • Author
  • Level 2
  • March 2, 2023

Thank you for your answer.

Unfortunately, the component filter does not work. 

I get the following error:

 

The aggregation function COUNT cannot be used inside a filter statement. Please check that there are no aggregations used inside filters. Please use a Pull-Up-function instead.

 

The second formula works very well


Thank you for your answer.

Unfortunately, the component filter does not work. 

I get the following error:

 

The aggregation function COUNT cannot be used inside a filter statement. Please check that there are no aggregations used inside filters. Please use a Pull-Up-function instead.

 

The second formula works very well

Yes, my bad. In that case you can try the CASE WHEN path, or use PU functions.


rene.szere
Level 2
  • Author
  • Level 2
  • March 2, 2023

What should the formula look like with the PU function? 

With "Case When", all the results are still displayed, but they are, for example, calculated with "0". I want all results where >2 are not displayed.


What should the formula look like with the PU function? 

With "Case When", all the results are still displayed, but they are, for example, calculated with "0". I want all results where >2 are not displayed.

Depends a bit on details, your model, what you want to measure... but, I guess:

 

PU_COUNT_DISTINCT(DOMAIN_TABLE(OCH_CASES._CASE_KEY), "OCH_Cases". "Party_Request_KEY")

 

BTW with the CASE WHEN this can work for you:

CASE

WHEN

COUNT(DISTINCT "OCH_Cases". "Party_Request_KEY") > 2

then COUNT(DISTINCT "OCH_Cases". "Party_Request_KEY")

ELSE NULL

END