Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Q about default selection as 12 month

Hello,

I want to set default selection when qv opens that shows the last 12 months (if we are on march than shows march/13-March/4)

For this I calculated in the scripts a field name  MonthAgo that shows how many months passed.

I added an action where

field name =MonthsAgo

and I need the search string to shows MonthsAgo>=0 and <12

I can't find the expression for it...

Thanks,

1 Solution

Accepted Solutions
christophebrault
Specialist
Specialist

Hi,

This solution works well in my case :

0. Clear all selection

1. Create a list with MonthsAgo

2. open the search input in the listbox's label and write this expression :

=only({$<MonthsAgo={">12"}>}MonthsAgo)

3. Add a bookmark and remember its ID (if it's the firs in your document its BM01)

4. Add an action when your document open and select bookmark = > apply a bookmark => BM01

It should work well

Inscrivez vous à ma Newletter Qlik
DoNotMissQlik- Connect with me on Linkedin

View solution in original post

12 Replies
tresesco
MVP
MVP

Are the values in MonthsAgo numeric? if so, try search string like : >=0<12

Not applicable
Author

you Can try this

sum({<Date_Field = {'>=$(=MonthStart(Max(Date_Field ), -12))<=$(=MonthEnd(Max(Date_Field )))'},Year=,Month=>}Sale)

Not applicable
Author

Hi,

Thanks a lot for the quick reply.

I would like to use this expression inside Add Action in the document property and not in a chart.

I want to define a new action to default select the last 12 months.

Thanks,

Limor

Not applicable
Author

yes there are numeric. I use this inside the "Add Action" in the "Document properties" and it is not working.

I want the program to select the last 12 months when opening the qlikview, by using the MonthsAgo field

tresesco
MVP
MVP

Couple of cases have to be taken into consideration. Could you post a sample app ?

Not applicable
Author

please give sample Data so i can explain more briefly

Not applicable
Author

I have a calendar with year and month

and I want the default selection on opening will be only the last 12 months.

christophebrault
Specialist
Specialist

Hi,

This solution works well in my case :

0. Clear all selection

1. Create a list with MonthsAgo

2. open the search input in the listbox's label and write this expression :

=only({$<MonthsAgo={">12"}>}MonthsAgo)

3. Add a bookmark and remember its ID (if it's the firs in your document its BM01)

4. Add an action when your document open and select bookmark = > apply a bookmark => BM01

It should work well

Inscrivez vous à ma Newletter Qlik
DoNotMissQlik- Connect with me on Linkedin
Not applicable
Author

You can try with a trigger on open documents that select in your date field the following expression:

='>='&Date(AddMonths(MonthStart(Today()),-12))

Regards.