Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
zototo
Contributor III
Contributor III

Comparison of the same periods (NOT YTD)

Hi everyone, 

Hopefully, you can help. I have a table where I need to have the following columns:

Previous Week Actual CY (current year) | Previous Week Actual LY (last year). 

For the current year, there's no problem, it's fine (I have a master calendar):

sum({<Year={"$(=Year(Max(Date)))"}, WeeksAgo = {1}>} Actual)

But for the previous Year Week it's a headache. All the related topics are based on YTD data and I could not find anything to help me. 

Looking forward to your support:)

Thank you!

Labels (4)
2 Replies
Or
MVP
MVP

Sounds like you'd want to create a flag for this as well, perhaps something along the lines of:

If(Weekname(AddYears(Today()-7,-1)) = Weekname(AddYears(Date-7,-1)),1,0 as LYWeeksAgo

// Do note that this will return the last week of the previous year in case of week 1, if you want to avoid that you'd need to add a condition

marcus_sommer

I assume that you use the WeekYear as dimension - which would prevent to display the data of another year. In this case just replace the WeekYear with the Week (maybe as horizontal dimension) and add Year as vertical dimension and then using something like sum(Value) as expression.