Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Expression for Traling days and months

I want get sum(sales) for the following daily and monthly data.

Daily data.

1) at first loading, I want to get 14 days of data from max date of data.

for example, if max date of data is 20150602 then the answer should be from 20150519 to 20150602.

2) if I select the date 20140501 then the answer should be from 20140418 to 20140501

Monthly Data

1) at first loading, I want to get 12 months of data from max date of the month of data.

for example, if max date of data is 20150602 then the answer should be from 201407 to 201506.

2) if I select the month 201405 then the answer should be from 201306 to 201505

That would be really great if you can help me out on this one.

1 Solution

Accepted Solutions
Not applicable
Author

Thank you very much. Your guide made it clear my problem.

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Hi, the below linked thread has tons of information on what you are looking for.  .

Show rolling 12 Months only for last 12 months.

sunny_talwar

Daily Data Expression:

=Sum({<Date = {"$(='>=' & Date(Max(Date) - 14, 'YYYYMMDD') & '<=' & Date(Max(Date), 'YYYYMMDD'))"}>}Sales)

Monthly Data Expression

=Sum({<Date = {"$(='>=' & Date(AddYears(MonthEnd(Max(Date)), -1), 'YYYYMMDD') & '<=' & Date(MonthEnd(Max(Date)), 'YYYYMMDD'))"}>}Sales)

HTH

Best,

Sunny

Not applicable
Author

Thank you. That helped a lot.

Not applicable
Author

Thank you very much. Your guide made it clear my problem.

tamilarasu
Champion
Champion

Hi Young,

If Sunny helped you to solve the problem, give the correct answer credit to him/her.