Hi everyone,
to show a graph with how many goods were not sent to customers (yet) on a specific date I followed the instructions of this example for filling ranges (Link).
Dimension:
RANGE_APPEND(ROUND_DAY("_CEL_O2C_ACTIVITIES"."EVENTTIME"), '7D', {d '2021-01-01' } , TODAY ())
KPI:
RUNNING_TOTAL(SUM(
CASE
WHEN "_CEL_O2C_ACTIVITIES"."ACTIVITY_DE" = 'X'
THEN 1
WHEN "_CEL_O2C_ACTIVITIES"."ACTIVITY_DE" = 'Y'
THEN -1
ELSE NULL END))
However, goods may be sent or received in multiple deliveries, thus leading to repeated activities.
1st Question: How do I only consider the last activity (and respective timestamp) per case?
2nd Question: How do I properly include this additional check, ensuring that all goods are actually sent out?
(CASE WHEN PU_FIRST("VBAP","MSKA"."VBELN" || "MSKA"."POSNR","MSKA"."KALAB" > 0 OR "MSKA"."KASPE" > 0) = "VBAP"."VBELN" || "VBAP"."POSNR"
THEN 1 ELSE 0 END) =0
Thanks and best regards
Aram