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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
prees959
Creator II
Creator II

Report Previous Week

Hi,

I need to be able to offer the ability that when a user clicks a button it only shows the previous Monday to Sunday information.

Could I set a flag for this in the script while the data is loading eg Prev_Mon_Sun_Flag ?

Any help appreciated,

Many thanks,

Phil

2 Replies
kamielrajaram
Creator III
Creator III

Hi,

I got mine working from a previous post using the method below. I apologise as I cannot remember the exact post.

Create 3 variables

vWeeks- add input box and under constraints,tick number series under predefined Values. From box=1 To box =10 and Step=1. Under Value List select predefined values in drop down list

vWeekStart= Date(Floor(Date(WeekStart(Today()-(vWeek*7)))))

vWeekEnd=Date(Floor(Date(Weekend(WeekStart(Today()-(vWeek*7)))))

Then in your expression

{<Date ={">=$(vWeekStart)<=$(vWeekEnd)"}>}

When the user drops down the list, they will have the ability to go back up to 10 weeks

Kind Regards

Kamiel

sergio0592
Specialist III
Specialist III

Hi,

From your date, create Week with Week() function in your script.

Create V_week variable with :

=if(FL_previous=1,Week(GetFieldSelections(Date)), (Week(GetFieldSelections(Date))-1))

FL_previous value change when user will clik on button.

And in your set , use as :

=Sum({<Date=,Week={$(=V_week)}>} Sales)

See the attached .qvw sample.