Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Obtaining Min and Max Dates from month and year listboxes

Morning guys

If I have two list boxes, one each for "Year" and "Month", how would I write an expression that would return either the min or max dates of my selection combination.

I.e if I have 2016, and January selected, how would I return 01/01/2016 and 31/01/2016?

Many thanks,

Gareth

1 Solution

Accepted Solutions
prat1507
Specialist
Specialist

Plz find the attached app for your perusal.


Regards

Pratyush

View solution in original post

11 Replies
prat1507
Specialist
Specialist

You can use

mindate

=makedate(GetFieldSelections(YearFilter),=Match(left(GetFieldSelections(MonthFilter),3), $(=chr(39) & Replace(MonthNames, ';', chr(39) & ',' & chr(39)) & chr(39))),1)


maxdate


=MonthEnd(makedate(GetFieldSelections(YearFilter),=Match(left(GetFieldSelections(MonthFilter),3), $(=chr(39) & Replace(MonthNames, ';', chr(39) & ',' & chr(39)) & chr(39))),1))


Regards

Pratyush

Anonymous
Not applicable
Author

Hi Pratyush,

Unfortunately neither work for me, the expression editor keeps informing me of an error in the expression where the second "=" operator appears.


Thanks,

Gareth

shraddha_g
Partner - Master III
Partner - Master III

Can you give detail about data in Those fields?

are year & Month field are calculated from Date Field?

prat1507
Specialist
Specialist

Plz find the attached app for your perusal.


Regards

Pratyush

Kushal_Chawda

Create below field in your Date

LOAD Year,

            Month,

            monthstart(floor(date#(Year&Month,'YYYYMMM'))) as MonthStart,

            monthend(floor(date#(Year&Month,'YYYYMMM'))) as MonthEnd

FROM Table;



create the two variables on front end vMonthStart & vMonthEnd


vMonthStart = only(MonthStart)

vMonthEnd= only(MonthEnd)

Anonymous
Not applicable
Author

Thanks Pratyush

That works a dime now!

Thanks again,

Gareth

m_s
Partner - Creator II
Partner - Creator II

You could also create a master calendar (or maybe you already have one?) containing a Date-Field, then you could simply use Min() and Max() functions.

Mathias

Kushal_Chawda

Use the method which I have suggested which is simple to implement

Anonymous
Not applicable
Author

I don't have access to amend the load scripts so unfortunately I can't use your solution.

Thanks,

Gareth