Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rajkumarb
Creator II
Creator II

Month Selection

Hi all

my current  max date is 17-aug-2017

if i dont make any selection in month field, then it should default to last full completed month
in my case that is june 2017
else if i make a selection in the month field means then it should be the selected month

below is the if condition I am using but its not working

please suggest.

=IF(len(GetFieldSelections([Calendar Month]) )=0, MONTHEND(AddMonths(today(-1), -1)),[Calendar Month])

1 Solution

Accepted Solutions
sunny_talwar

Is Jan, Feb, Mar.... your calendar Month field? What is the date field my friend? Did you expect Jun to convert to a date by itself? Use this

Date(If(GetSelectedCount([Calendar Month]) = 0, (MonthStart(Today()) - 1), Max(DateFieldHere)))

View solution in original post

11 Replies
harshitha10394
Contributor II
Contributor II

Hi Raj,

Can you clearly explain your requirement. Pls!!

Thanks

Harshitha

kaushiknsolanki

Hi,

Try this.

IF(GetFieldSelections([Calendar Month])=0, MONTHEND(AddMonths(Max([Calendar Month]), -1)),Max([Calendar Month]))


Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
rajkumarb
Creator II
Creator II
Author

Hi Kaushik

its not working as expected

kaushiknsolanki

Kindly share your application.

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
sunny_talwar

What exactly is your goal here? Make a month selection or just save the value in a variable? Would you be able to elaborate a little?

rajkumarb
Creator II
Creator II
Author

Hi sunny

I want to store this in a variable

=IF(len(GetFieldSelections([Calendar Month]) )=0, MONTHEND(AddMonths(today(-1), -1)),[Calendar Month])

my requirement is

my max date in my app is 17-aug-2017

in my text box with my variable want to see a month, if no selections were made on month list box, then it should show last fully completed month(which is June 2017) in my text box, else selected month need to shown

sunny_talwar

May be this

Date(If(GetSelectedCount([Calendar Month]) = 0, (MonthStart(Today()) - 1), Max([Calendar Month])))

rajkumarb
Creator II
Creator II
Author

sunny

When I use this in the text box and select June

its displaying

05/01/1900

sunny_talwar

Can you show an image of a list box for Calendar Month?