Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

auto select this month and last month on open....

I have a date field (CallDateMonthYear) that displays as 'MMM-YYYY'.  On opening, I want to auto select this month (for example Sep-2018) and LAST month (Aug-2018).  I've tried a few different things and am totally lost.  Suggestions??

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can try an OnOpen trigger under Settings - Document properties - Triggers with a Selection - Select in field action:

2018-09-04 23_14_47-Window.png

='('&Date(Today(),'MMM-YYYY')&'|'&Date(Addmonths(Today(),-1),'MMM-YYYY')&')'

View solution in original post

4 Replies
swuehl
MVP
MVP

You can try an OnOpen trigger under Settings - Document properties - Triggers with a Selection - Select in field action:

2018-09-04 23_14_47-Window.png

='('&Date(Today(),'MMM-YYYY')&'|'&Date(Addmonths(Today(),-1),'MMM-YYYY')&')'

Anonymous
Not applicable
Author

Worked!  Thank you!

Anonymous
Not applicable
Author

So.  Going back to the well one more time...I have another field that gives me week ending dates and they are formatted 09/08/2018 for example.  I tried the same concept but to select that field using this:

='('&Date(WeekEnd(Today(),-1),'MM/DD/YYYY')&'|'&Date(WeekEnd(Today(),-2),'MM/DD/YYYY')&')'

but it DOES NOT work for some reason.  I put this in a text box to see if it was giving me the right results and it did (the expression you provided which is working as expected to limit the results to current and previous month is in the bottom text box and the expression above is in the top text box:


9-4-2018 7-46-40 PM.jpg


But when I do the exact same steps to put that as the search string for selecting the other field (CallDateWeekYear) it only shows the FIRST week in that range and not both.  Since partial weeks are giving numbers that distort trend lines, I'm going for last full week and the full week prior to that...

swuehl
MVP
MVP

Do you have any other selections present when applying that action?