Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trigger a selection with an expression

Hello,

I want to create a trigger on the tab activation.

I have a field Date(format DD.MM.YYYY) and i would like to select all values from the past year to the previous month.

For example, today i would like the trigger to select only the values from February 2013 to February 2014.

Can someone help me to build the expression which could do this please?

The current month is in a variable Month and the current year in the variable Year.

Thanks,

Best Regards,

Loïc

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Change your search string as below...

='>=$(=MonthEnd(Today(),-13))<=$(=MonthEnd(Today(),-1))'

View solution in original post

5 Replies
MK_QSL
MVP
MVP

Something like enclosed file?

If you want date from last year to today

i.e. 12/03/2013 to 11/03/2014 use

='>$(=AddYears(Today(),-1))' in expression with TempDate as Dimension (Select in Field)

You can also use

='>$(=AddMonths(Today(),-12))'

sudeepkm
Specialist III
Specialist III

You may create a new field in the script as a YOY Flag using the below expression.

if(Date <= Today() and Date >= MonthStart(AddMonths(Date(Today()), -13)),1,0) as YOYFlg,

The new YOYFlag will be 1 if your Date is between today and last 13 months else it will be 0.

Now you can add action to a navigation button just Select in Field YOYFlag as 1.

Please take a look at the attachment.

Not applicable
Author

Thank you for your very helpful answer!

But is this possible to select from last day of the previous month last year to the last day of the previous month this year (from 28/02/2013 to 28/02/2014)?

MK_QSL
MVP
MVP

Change your search string as below...

='>=$(=MonthEnd(Today(),-13))<=$(=MonthEnd(Today(),-1))'

sudeepkm
Specialist III
Specialist III

You can use MonthEnd function.

MonthEnd(AddMonths(Date(Today()), -13))