Dear Celonis Community,

I am trying to count how many invoices have single line items, and how many have more then 2, 3, etc.

I am able to get the formula to work when i create a OLAP table as per the below:

The Dimension = “BSEG”."_CASE_KEY"

KPI = COUNT_TABLE(“BSEG”)

In the third column I have the below code that produces the correct result as indicated in my table.

case when COUNT(“BSEG”."_CASE_KEY")=1 then 1 else 0 end

However, my intention is to count the total number of cases where invoice has only 1 line item. When i remove the dimension of Case_Key and replace it with “CASES”.“CompanyCode”, it produces a zero value.

I have tried different statements such as:

COUNT(

CASE WHEN PU_COUNT(“CASES”, “BSEG”."_CASE_KEY") = 1

THEN “BSEG”."_CASE_KEY"

ELSE NULL

END

)

But this only produces a count of ‘0’.

Can you please advise what i am doing wrong, and how i can correct for this error.

Thanks,

Anna