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: 
Not applicable

Default Current Week Selection

I have a project where I have to display current week data by default(i.e. 11/17/2014- 11/21/2014), I worked with Default Day and Month for which I used Month(Today(1) and Day(Today(1)) worked with no issues. But now I use Week(Today(1)) for week and end up with integer value of  current week.

Any help would  be appreciated.

Thanks!!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Create Two Variables

vCurrentWeekStart

=Date(WeekStart(Today()))

vCurrentWeekEnd

=Date(WeekEnd(Today()))

Now go to Settings - Document Properites - Document Event Triggers - On Open Trigger

Add Actions

Add

Selection  -  Select in Field

Field

Date

Search String

='>='&vCurrentWeekStart &'<='&vCurrentWeekEnd

Now whenever you open this document, by default the current week dates will get selected...

==============================================

If you want SUM(Sales) for current week, use as below

=SUM({<Date = {">=$(=WeekStart(Today()))<=$(=WeekEnd(Today()))"}>}Sales)

Hope anyone from above would be the same you are looking for...

View solution in original post

8 Replies
simondachstr
Specialist III
Specialist III

Try the below:

=Date(Min({<Date={"=week(Date)=week(Today())"}>} Date)) & ' - ' & Date(Max({<Date={"=week(Date)=week(Today())"}>} Date))

If you still want to be able to click around in the Date field you can use set analysis:

=Date(Min({<Date={"=week(Only({1} Date))=week(Today())"}>} Date)) & ' - ' & Date(Max({<Date={"=week(Only({1} Date))=week(Today())"}>} Date))

Not applicable
Author

Hi,

I'm not sure understand but I'll using a variable vCurrentWeek = Week(Today()), for example if I need my sales of actual week, I use next expression:

Sum({${<Week={$(vCurrentWeek)}>}}Sales)

or if you don't use a variable try:

Sum({${<Week={$(#=Week(Today()))}>}}Sales)

or if you don´t have a week field try

Sum({<Date= {">=$(=WeekStart(Today()))<=$(=Date(WeekEnd(Today())-2))"}>} Sales)

Regards.

MK_QSL
MVP
MVP

Create Two Variables

vCurrentWeekStart

=Date(WeekStart(Today()))

vCurrentWeekEnd

=Date(WeekEnd(Today()))

Now go to Settings - Document Properites - Document Event Triggers - On Open Trigger

Add Actions

Add

Selection  -  Select in Field

Field

Date

Search String

='>='&vCurrentWeekStart &'<='&vCurrentWeekEnd

Now whenever you open this document, by default the current week dates will get selected...

==============================================

If you want SUM(Sales) for current week, use as below

=SUM({<Date = {">=$(=WeekStart(Today()))<=$(=WeekEnd(Today()))"}>}Sales)

Hope anyone from above would be the same you are looking for...

Anonymous
Not applicable
Author

Do be aware that On Open Triggers do not work with the Ajax Client, only with the IE Plugin

oscar_ortiz
Partner - Specialist
Partner - Specialist

I use Manish's idea all the time and have yet to experience issues with triggers and Ajax.

Not applicable
Author

it works perfect,but i have 6 sheets and they should have default week view.

Does the on Open document trigger works for all sheets or do i have to use sheet triggers??

I prefer to use On Open document trigger.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Open document trigger is applied once when the document is opened, after that if you clear the selections it won't retain, if you want to retain in every sheet then you have to use Sheet Triggers.  This all depends on your requirement, if you just want when opening the document just use Document Trigger or if you want to retain every time when the sheet is loading then use Sheet Triggers.


Hope this helps you.


Regards,

Jagan.

Not applicable
Author

Got it..

Thanks!!