Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
dhasharadh
Creator III
Creator III

Need select in Field action to a button. last 12 months

in Qliksense,  last 12 month needs to be selected when we landed into any page from the Landing page.

My landing page have Diff buttons to navigate to different pages, in the button along with go to sheet action, am trying to add this action select in field and using the Month field, but am not able to achieve it. 

i have only Inflow Date and Inflow_Year_Month fields which is derived from Inflow_Month, using Inflow_Year_Month  have to select last 12 months on landing, so that it will be clear to users that 12/56 are selected in current selection pane on landing. 

if we use Inflow_Date am getting like 326/1512 days...

Infow_Date format is DD.MM.YYYY and Inflow_Year_Month format is YYYYMM.

It would really helpful.. if any one provided the expression to use for this. 

Thanks Much.

 

1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

Maybe you can follow a different approach here. Instead of using "Select values in a field" action, you can use the "Select values matching search criteria". This way you can use an expression like this: ='*/$(=Year(Today()))' where the dates in the dataset have the format: "MM/DD/YYYY". This expression will select all the dates where the year is the one that we have currently! 

 

If you would like to select all the previous 12 months then you can use the following expression for example: '>$(=MonthStart(AddMonths(Today(), -12)))'.

 

This expression will use the Today() function to get the current date and then it will use the AddMonths() function to subtract 12 months from the current date. Finally using the function MonthStart(), we can get the first day of the month so with the combination ">" in the expression it will select all the dates that are dated from 12 months before and after.

 

You can modify the expression based on your needs and your dataset values, but you can also get the logic behind it and build on that for a more complex use case scenario!

 

In my example this is the dataset that I have:

SCREENSHOT

 

And with the expression  '>$(=MonthStart(AddMonths(Today(), -12)))' I get the following selected values: 

 

With minor modifications, you can get a much better result if you like 😊

 

I hope that this information was helpful. In case the issue was resolved, please mark the answer as solution to give it more visibility for other community members. Otherwise, if I have misunderstood the use case scenario, please elaborated in details by providing additional information! 

 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

1 Reply
Andrei_Cusnir
Specialist
Specialist

Hello,

 

Maybe you can follow a different approach here. Instead of using "Select values in a field" action, you can use the "Select values matching search criteria". This way you can use an expression like this: ='*/$(=Year(Today()))' where the dates in the dataset have the format: "MM/DD/YYYY". This expression will select all the dates where the year is the one that we have currently! 

 

If you would like to select all the previous 12 months then you can use the following expression for example: '>$(=MonthStart(AddMonths(Today(), -12)))'.

 

This expression will use the Today() function to get the current date and then it will use the AddMonths() function to subtract 12 months from the current date. Finally using the function MonthStart(), we can get the first day of the month so with the combination ">" in the expression it will select all the dates that are dated from 12 months before and after.

 

You can modify the expression based on your needs and your dataset values, but you can also get the logic behind it and build on that for a more complex use case scenario!

 

In my example this is the dataset that I have:

SCREENSHOT

 

And with the expression  '>$(=MonthStart(AddMonths(Today(), -12)))' I get the following selected values: 

 

With minor modifications, you can get a much better result if you like 😊

 

I hope that this information was helpful. In case the issue was resolved, please mark the answer as solution to give it more visibility for other community members. Otherwise, if I have misunderstood the use case scenario, please elaborated in details by providing additional information! 

 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂