Discussion board where members can get started with QlikView.
Hi, good day everyone !
I want to get the number of months between 2 months. where
The expression I am using is
Month ([Expiry Date])-$(@calendarMonth) where Month([Expiry Date]) returns result like 'Aug' and $(@calendarMonth) returns result like 'July'.
Is it I need to convert the month string to number ?
Thanks sincerely for your help :-)
Solved! Go to Solution.
Thanks Sokkorn Cheav, it works for the Expiry Date. How about the $(@calendarMonth) ?
I tried Num($(@calendarMonth)) but it does not return me 6 when I selected Jun.
The expression for variable @calendarMonth is =GetFieldSelections(PeriodMonth).
It is from a list box selection. For example, when user select 'Jun', I need to pass 6 into my expression
Month ([Expiry Date])-$(@calendarMonth). Thus, the result will be 8-6 =2
Your variable expression =GetFieldSelections(PeriodMonth)
will return string value something like 'Jun'. So you need to convert it into number with this expression @calendarMonth = GetFieldSelections(Match(PeriodMonth, $(=chr(39) & Replace(MonthNames, ';', chr(39) & ',' & chr(39)) & chr(39))))
Test it and let me know the result.
Sokkorn is right bt much easy way u can work is with following expression
I have changed the expression of @calendarMonth to =GetFieldSelections(Match(PeriodMonth, $(=chr(39) & Replace(MonthNames, ';', chr(39) & ',' & chr(39)) & chr(39))
but variable $(@calendarMonth) returns nothing when the 'Jun' is selected in the listbox Calendar Month.