Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
robbybalboa
Contributor III
Contributor III

YTD + LYTD button - error

Hello,

I have created a textbox button with the following statement:


='(>='  &YearStart(Today())&  ' and <='&  date(Today())   &')

or

(>='  &YearStart(Today(),-1)&  ' and <='&   AddMonths(Today(),-12)  &')'

Result text-string:

(>=01.01.2013<=22.08.2013) or (>=01.01.2012<=22.08.2012)


This result is a parameter in a text box -->  action --> selection in field


So far so good.

Problem: Only the first part of the search criteria is used in my app.

The filter is only working for the period 01.01.2013 – 22.08.2013.


Any ideas why this solution does not work?

If I change the input to (>=01.01.2012<=22.08.2012) or (>=01.01.2013<=22.08.2013) then
the search is only possible for the period 2012.


Thank you very much

Robert

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try:


='(>='  &YearStart(Today())&  ' and <='&  date(Today())  & '| >='  &YearStart(Today(),-1)&  ' and <='&   AddMonths(Today(),-12)  &')'


talk is cheap, supply exceeds demand

View solution in original post

11 Replies
tresesco
MVP
MVP

try removing the braces, like

>=01.01.2012<=22.08.2012 or >=01.01.2013<=22.08.2013

robbybalboa
Contributor III
Contributor III
Author

Hi,

without braces no search is possible.

Even if I type in this directly into a listbox.

I think the braces are necessary.

tresesco
MVP
MVP

try to put this string directly in the search string (without '='). it should work if the date format is similar.

>=01.01.2012<=22.08.2012  or  >=01.01.2013<=22.08.2013

robbybalboa
Contributor III
Contributor III
Author

OK - if I put this string in a listbox then it works.

But how can I achieve now a button to to this? Because here I need a '='.

I have tried now to create my search string in the script.

Result is the same as I do it in the text box under action. Only year 2013 selection is available

tresesco
MVP
MVP

try:

='>='  &YearStart(Today())&  '<='&  date(Today())   &

'or' &

'>='  &YearStart(Today(),-1)&  '<='&   AddMonths(Today(),-12)

robbybalboa
Contributor III
Contributor III
Author

Unfortunatly still only 2013 period selected.

2012 will be ignored..

tresesco
MVP
MVP

Could you please share the sample app?

robbybalboa
Contributor III
Contributor III
Author

See attached. Thank you so far.

Gysbert_Wassenaar

Try:


='(>='  &YearStart(Today())&  ' and <='&  date(Today())  & '| >='  &YearStart(Today(),-1)&  ' and <='&   AddMonths(Today(),-12)  &')'


talk is cheap, supply exceeds demand