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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Same day last year problem

Hi all,

I have a requirement wherein i got to get the sum of values starting from same day last year + 60 days in last year.

for example today is 06/09/2017 so i need to get sum(value) from 06/09/2016 till 09/07/2016.

Any help will be much appreciated.

Thanks in advance

Anupama Jagan

Labels (1)
1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

=SUM({<DateFieldName = {'>=$(=AddYears(Today(),-1))<=$(=Date(AddYears(Today(),-1)+60))'}>}Sales)

View solution in original post

5 Replies
hector_munoz
Specialist
Specialist

Hi Jagan

Try the following:

sum({< date_field={'<=$(#=vInitialDate)>=$(#=vFinalDate)'}>} sales)


, where:


vInitialDate = AddMonths(Today(), -12)

vFinalDate = AddMonths(Today(), -12) + 60


Regards,

H

MK_QSL
MVP
MVP

=SUM({<DateFieldName = {'>=$(=AddYears(Today(),-1))<=$(=Date(AddYears(Today(),-1)+60))'}>}Sales)

ahaahaaha
Partner - Master
Partner - Master

Hi,

Look attached file

tajmohamed30
Creator III
Creator III

you can try -60 from above examples

richard_chilvers
Specialist
Specialist

...a word of caution - in my experience the AddYears and AddMonths functions often do not work effectively for leap years (ie. where 29th Feb is involved). I prefer to work out the same day last year using the same weekday and same week number from the previous year.