Unable to apply filter on an aggregate function

I’ve a table component with 2 dimension:
Dimension 1: Combination of Company code + Vendor ("'BKPF".“BUKRS”||“BKPF”.“LIFNR”)
Dimension 2: Count of documents (COUNT(DISTINCT “BKPF”.“BELNR”))
However I’m unable to filter the ‘Document count’ with count > 1. The system returns the error “An aggregate is not a function. Please check that there are no dimension and aggregations used together as function inputs”.

Can anyone suggest how to achieve the filter?

Hi,

you cannot use regular aggregation functions inside FILTERs. For this, you need to use PU functions:

FILTER PU_COUNT_DISTINCT(DOMAIN_TABLE("BKPF"."BUKRS", "BKPF"."LIFNR"), "BKPF"."BELNR") > 1;

For more information about PU functions, please have a look at the corresponding pages in the documentation.

Best
David

Hello David,

Thanks for your reply. Your suggestion seem to work but I see different results for COUNT(DISTINCT “BSEG”.“BELNR”) & PU_COUNT_DISTINCT(DOMAIN_TABLE(“BKPF”.“BUKRS”, “BKPF”.“LIFNR”), “BKPF”.“BELNR”). COUNT(DISTINCT) function returns correct value but PU_COUNT_DISTINCT is returning incorrect value.

Any idea why? Can you suggest where can I find some examples to understand how PU_COUNT_DISTINCT function works?

Regards,
Vijay Segu