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

is it possible to automate the field in selection value in Qlikview..??

I have filter named GasMonth and its in YYYY-MM format , am trying to add this filter selection in a button and which should pick previous month automatically. am giving all this actions to button and which will trigger once the app reloaded I have macro to trigger the button.

How can I select prev month using actions please help bit urgent.

tried field in selection option and used GasMonth field and coming to value :  Date(Month(Today(GasMonth),-1),'YYYY-MM')  and am getting 1900-01 instead of 2020-08

Ex : current month it has to select 2020-08 and next month it has to pick 2020-09..

Please help me thanks much..

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda

@dhasharadh can you try below?

vMonth = date(addmonths(Today(),-1),'YYYY-MM')

View solution in original post

6 Replies
Taoufiq_Zarra

@dhasharadh 

I don't know if I understood correctly, but for example from your field GasMonth

for NextMonth you need ->

=Date(AddMonths(GasMonth,1),'YYYY-MM')

previous month:

=Date(AddMonths(GasMonth,-1),'YYYY-MM')

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
dhasharadh
Creator III
Creator III
Author

Thanks Taoufiq for the quick response,  my requirement here is button will trigger on reload with the help of a macro and button has to make few selections out of which this is one selection.

whenever we reload the app button has to make the GasMonth selection to Prev month which is 2020-08.

 

 

Surya
Creator II
Creator II

Hello,

For my understanding  you are using macros in your applications throgh that you reload your application.

if its correct or wrong do following steps.

create one variable which month you required 

eg: if  you required current month 

=max(month)

last month

=max(month) -1

now goto buttion actions select field selection

set u r field in value then

='$(variable)' 

 

dhasharadh
Creator III
Creator III
Author

Surya Thanks for your time,

But tried below all but not picking the Month, am not sure what is wrong here.  in that button am adding other actions like a bookmark and year(select in field) and a month.

for year this var expression working vYear = Year(Today()) (for variable value setting and for select in field using =$(vYear)  and this is working fine.

For month we are using vMonth = Num(Month(Today()))-1  and in the text it is showing as 8 but in the filter it is not making the selection.

in the filter called gasMonth - values are in the form of 2020-08 , 2020-09

Please reply with your suggestions. Thanks Much

 

Kushal_Chawda

@dhasharadh can you try below?

vMonth = date(addmonths(Today(),-1),'YYYY-MM')

dhasharadh
Creator III
Creator III
Author

That is perfectly working. Thanks kush. 

and while am exporting the chart data into a csv file,  only few records are getting exported and there is a sorting issue as well. 

the reason might be in the dashboard we have a Table Box with 8 columns and for exporting am only adding first column which might be leading to data mismatches (less number of records are getting exported) and also there is a sorting issue.

i have other plan but not sure on its possibility :  can we export the entire tables box in excel and after exporting take out the first column and store it in the txt format which is our ultimate requirement.

can you please suggest with your thoughts.