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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Promotion event wise Data - last 'n' Days

Hi Team,

I have a list of promotion events, Promo_start_date and Promo_end_date, lets consider i am having promotion events for last 3 years.

To show the current year and last year Promo sales, i am using

Sum({<year={$(=max(Year))}>}sales) 

and


Sum({<year={$(=max(Year)-1)}>}sales)

Next i need to show last 7 days sale. When i use Max(promo_to_Date)-7, it's not throwing desired output, how can i build the expression?

Help me on this. Thanks in advance.

Regards,

Sadasiva

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

if(

   (Date<=Promo_Date_To) and(Date>= Promo_Date_To - 6),

   Promo_Event

   )

this condition works for me, to get last n days sales.

View solution in original post

6 Replies
juan_patrick
Creator
Creator

Hi Sadasiva!

Try with this:

Week(promo_to_Date) - 7


but you will have trouble at the start of the year

Anonymous
Not applicable
Author

Hi Juan,

Need to consider the year aswell, I am looking current and last year numbers by promo event

Regards,

sadasiva

juan_patrick
Creator
Creator

Sadasiva,

you can tho this in the script:

AUTONUMBER( year_field & '-' & month_field & '-' & WEEK(date_field))  AS new_field

So you can rest 7 to the new_field

¡Good luck!

Anonymous
Not applicable
Author

Hi Juan,

I have linked promotion dates to my Posting date, from there am picking the sales.

Here the problem was every promotion start in different date and end with different dates. When i am seeing the current year sales, overall i am able to view. How can i show last 7 days of every promotion days by promotion event.

Hope you understand my problem.

Regards,

Sadasiva

juan_patrick
Creator
Creator

Hi Sadasiva,

So you have to create a flag (a new field) in the script to know for each one is you must show it or not.

Anonymous
Not applicable
Author

if(

   (Date<=Promo_Date_To) and(Date>= Promo_Date_To - 6),

   Promo_Event

   )

this condition works for me, to get last n days sales.