Skip to main content

Hello all, im trying to compare the sales between last week and the weekly average of the last 6 weeks in several materials. For this I wrote the following code for the kpi:

(material is set as dimension)

(there is a component filter that limits the data to the last 6 weeks as well)

round ( ( ( 7 * SUM ( "VBAP"."NTGEW" ) / 43 ) / 1000 ) - ( ( SUM ( Case When "VBAP"."ERDAT" > ADD_DAYS ( TODAY ( ) , - 9 ) THEN "VBAP"."NTGEW" else 0 end ) ) / 1000 ) , 2)

 

However, in the OLAP I only want to see the materials where this difference is positive so I tried to do a filter where:

FILTER "Material" IN (CASE WHEN "DIfference code above" > 0 THEN MATERIAL ELSE NULL END)

 

But I get an error message saying that I cannot use the SUM aggregator in Filter.

 

Does anyone know how to solve this ?

I think you need to use a PU_SUM instead the SUM.

Without digging too much in your PQL, I guess it should work with PU_SUM(CONSTANT(),your case when stuff...)

 

 

HTH


Reply