Skip to main content
Question

Unable to apply filter on an aggregate function

  • January 20, 2021
  • 2 replies
  • 18 views

Ive 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 Im 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?

2 replies

Forum|alt.badge.img+2
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

  • Author
  • Level 1
  • January 27, 2021

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