Skip to main content
Question

Count Item based on Header filter

  • December 20, 2019
  • 1 reply
  • 7 views

Hello,

I try to count the number of sales order items based on a filter on headers.

I manage to do that:

SUM(CASE

WHEN VBAK.BSARK NOT IN (ZWEB, DFUE, ZMYP, ZMWS, ZTEL, ZPBI)

AND VBAK.ERNAM NOT IN (BZTLK, BTS16)

AND VBAK.VBTYP = C

THEN 1

ELSE 0

END)

But it only counts sales orders and not sales order items.

Note that I manage to do it with a Pivot Table (since we can choose on KPI to count VBAP or VBAK) but I also want to have percentages on the same OLAP table.

Thank you in advance

Antoine

1 reply

Hi Antoine,

you can try to use the following formula which specifically counts on the item level:

COUNT(DISTINCT CASE WHEN VBAK.BSARK NOT IN (ZWEB, DFUE, ZMYP, ZMWS, ZTEL, ZPBI) AND VBAK.ERNAM NOT IN (BZTLK, BTS16) AND VBAK.VBTYP = C THEN "VBAP"."MANDT"||"VBAP".VBELN"||"VBAP"."POSNR" ELSE NULL END)

Best regards,

Viana