Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
mikegrattan
Specialist
Specialist

Problem with RangeSum and set expression

Please help me figure out the set expression below.

I have the following expression which is working, as long as I am manually selecting a CommodityCode and a DateFlag. It does not work by itself at this point, even though I am specifying the correct filters in the set expression.

What I would like to do is modify the expression so that it will work for a specific CommodityCode, such as LTC, and a specific DateFlag, such as DateFlag_SixWeeks.  The DateFlag_SixWeeks dimension is defined in the data load, and it selects all dates that are prior to the current week - 6 weeks; the value is 1 when true and 0 when false.

RangeSum(Above(Total (RangeSum(Above( (Aggr(Avg(TOTAL Aggr(Sum({<DateFlag_SixWeek={'1'}, CommodityCode={'LTC'}>} EquivalentQuantity),
ShipDate,Week)), ShipDate,Week) ) , 0, 6)) ) , 0, 6))

mikegrattan_0-1679948008519.png

 

The table I'm using for this example contains the following columns:

CommodityCode
Week
Avg (cumulative expression above)

Although ShipDate is not in the table it appears that it is needed in order for the correct accumulation week-over-week.

I imagine that the set expression, {<DateFlag_SixWeek={1},CommodityCode={'LTC'}>}, needs to be added to the RangeSum and/or Aggr functions but I have not been able to get it to work after trying several variations.

Any suggestions?

 

Labels (1)
10 Replies
mikegrattan
Specialist
Specialist
Author

Wow...yes, that works perfectly.  Thank you so much.