Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to select value in list box that is preceding the current selection

I am wanting to create some dynamic text in a textbox. I am working on a financial dashboard, and one of the functions I am creating is to have a button that will calculate the currently selected month to the previous month. My listbox is populated with the month values

month(Date(MonthStart(TRAN_DT,0),'MM/DD/YYYY')) as MONTH_DATE

from the above created field. If the user selected March, I would like the button to say "Comparison of March to February of current year.

Any help is appreciated

Mike

1 Reply
MarcoWedel

Hi,

maybe one solution could be:

QlikCommunity_Thread_268122_Pic1.JPG

QlikCommunity_Thread_268122_Pic2.JPG

QlikCommunity_Thread_268122_Pic3.JPG

='Comparison of '&Date(Date#(MONTH_DATE,'MMM'),'MMMM')&' to '&Date(Date#(Mod(MONTH_DATE-2,12)+1,'M'),'MMMM')&' of current year.'

(You can skip the Mod() part as comparisons between Jan and Dec probably don't make much sense, it just didn't feel right to have no predecessor to Jan. Maybe it would be better to use a YearMonth field instead, e.g. using the MonthName() function?)

One note regarding your MONTH_DATE field:

You could just generate it like


Month(TRAN_DT) as MONTH_DATE

because neither the nested Date() nor MonthStart() function change the resulting Month() value of your expression.

hope this helps

regards

Marco