Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
zcatoe
Contributor
Contributor

Transitioning year and pulling previous YTD data

I am trying to pull YTD from a previous year (2021) now that we have transitioned into the new year. Previously, this is the expression I always used:

Sum( {$<IsInYTD={1},[Restated POS Year] = {$(=Max([Restated POS Year]))}>} [Retail Sales Dollars])

Is there a simple change I can make to this formula in order to still get full YTD 2021 data for this particular set or will I have to change more in the script itself? 

Thanks in advance!

Labels (1)
1 Reply
_Gerardo_
Partner - Contributor III
Partner - Contributor III

Your formula is still valid for Current YTD, for Previous YTD (PYTD) you need to create a new one:

1.  Assuming that the values for Restated POS Year are all years, you will need to decrease in 1 the max year:

$(=Max([Restated POS Year])-1)

2. Optionally In script, create a new Flag IsInPTYD (is in Previous Year To Date) with value 1 for 2021 and 0 for current year and the rest of the years, or just remove that part from Set Analysis formula.

Final version of formula with suggested changes:

Sum( {$<IsInPYTD={1},[Restated POS Year] = {$(=Max([Restated POS Year])-1)}>} [Retail Sales Dollars])

Regards.