Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mfigueiredo
Contributor III
Contributor III

Calculating an Average: This year plus first week of next year

Hi Qlik Community,

I have a quick question, which I hope I could solve with nested set analysis, however, since this involves two dimensions I'm not so sure what the approach should be.

I have a very specific and simple set of data, with five dimensions: Year, Week, MarketCd, VolumeStocksKgs, VolumeStocksTon.

This data spans over 2013-2015.

I have to put in a small pivot or straight table the year average of VolumeStocksTon. This is very simple, however this average interval is between the 2nd week of the year, let's say 2014, and go until the first week of 2015.

This is not a rolling average, it's always the same for each year (unless data is not available yet).

Could you help me with an expression that works here?

I tried set analysis, but I am either restricting the year, or not including the first week of the next year.

Thank you,

Mariana.

2 Replies
Anonymous
Not applicable

I recommend to pre-aggregate this in the script.  Calculate average grouped by a "period", where the "period" is the time span from the second week of one calendar year through the first week of the next calendar year.

mfigueiredo
Contributor III
Contributor III
Author

Hi Michael,

Thanks for your reply.

I was hoping to solve this with set analysis, but I will try to do that in the script. It seems simpler and easy.

Mariana.