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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AddYears - how to?

how do I modify the code below to be able to 1 year less than the SELECTED year?  I tried adding the ADDYEARS and a -1 to the code, but couldn’t get it to work correctly. 

=Num(Sum({<[Account Description] = {'Total COGS'}, MonthYear = {"$(='>' & Date(AddMonths(QuarterStart(AddMonths(Max(MonthYear), 1))-1, -12)) & '<=' & Date(QuarterStart(AddMonths(Max(MonthYear), 1))-1))"}, Year, Month, Quarter>} Actual),'#,##0')

Thank you for any assistance you can offer!!!!

Kelly

stalwar1

1 Solution

Accepted Solutions
sunny_talwar

May be this:

=Num(Sum({<[Account Description] = {'Total COGS'}, MonthYear = {"$(='>' & Date(AddMonths(QuarterStart(AddMonths(Max(MonthYear), 1))-1, -24)) & '<=' & Date(AddMonths(QuarterStart(AddMonths(Max(MonthYear), 1))-1, -12))"}, Year, Month, Quarter>} Actual),'#,##0')

View solution in original post

8 Replies
nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

what is ur year format ?

-nagarjun

sunny_talwar

May be this:

=Num(Sum({<[Account Description] = {'Total COGS'}, MonthYear = {"$(='>' & Date(AddMonths(QuarterStart(AddMonths(Max(MonthYear), 1))-1, -24)) & '<=' & Date(AddMonths(QuarterStart(AddMonths(Max(MonthYear), 1))-1, -12))"}, Year, Month, Quarter>} Actual),'#,##0')

Not applicable
Author

2008

Not applicable
Author

I added an additional

)

after the last -12 and it worked like a charm! 

Thank you - Sunny T!

Kelly

sunny_talwar

Right, I forgot to add that

sunny_talwar

Wow, you just pushed my past 100,000

Not applicable
Author

YAY Sunny T!  Congrats! 

sunny_talwar

Thanks Kelly