Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgandhi715
Contributor III
Contributor III

Select two dates from one column using a button


Hi,

I want to select all dates  between the dates selected by user. I have added two calendar objects and have used two variables to get the From and To date selected by the user. I have a button "Commit" on click of this button i want to select all the dates between these two dates. The expression i have written was working fine till the time i changed the date format in the load process.

The date format I am using is "DD-MMM-YYYY"

The expression i am using is

='>=' & Date(vFromDate, 'DD-MM-YYYY') & '<=' & Date(vToDate, 'DD-MM-YYYY')

Is it the problem with the format of the date? or is there something that i am missing?

Any response is greatly appreciated.

Thanks in advance.

Nikhil.

10 Replies
whiteline
Master II
Master II

Hi.

May be like this ?

='>=' & num(Date(vFromDate, 'DD-MM-YYYY'), '0') & '<=' & num(Date(vToDate, 'DD-MM-YYYY'), '0')

Is your date field really date or just text ?

nikhilgandhi715
Contributor III
Contributor III
Author

Hi,

Thanks for the reply.

I have used Num#(Date([Date Field]),'DD-MMM-YYYY') as a expression while loading the dates.

I tried using the expression you have mentioned, however it does not work.

When i try using =Date($(vFromDate))  it is allowing me to select the date also with ='01-Jan-2012', but the problem comes when i prefix it with '>='

Hope this gives you an idea...

Nikhil


whiteline
Master II
Master II

Yes.

You use different ways. When one date is selected the selection is made as text selection.

For the interval selection your date should be numbers.

Create a listbox with your dates and notice the alignment. By default numeric values aligned to the left right, while text to the right left.

nikhilgandhi715
Contributor III
Contributor III
Author

Hi,

I am not yet used to qlikview still learning.

I can see that the dates are aligned to left side which means it is numaric.

I am a bit confused with the date formats in qlikview.. do you have any other suggesstion on this... or if you have any document or link which can explain these date formats that would be a great help.

Gysbert_Wassenaar

See this video tutorial: Selecting Arbitrary Date Ranges

And this blog post: Why don’t my dates work?


talk is cheap, supply exceeds demand
nikhilgandhi715
Contributor III
Contributor III
Author

Hi Gysbert,

Thanks for the details.

It is a usefull material. However i am still stuck with my problem.

Not sure what to do because i have tried almost all the combinations to make it work.

Anonymous
Not applicable

Aligned to the left means (by default) that it is text.

Try to replace your Num#(Date([Date Field]),'DD-MMM-YYYY') with

date(date#('20-Jan-2013','DD-MMM-YYYY'), 'DD-MMM-YYYY')

nikhilgandhi715
Contributor III
Contributor III
Author


Michael,

I think that it is the only option I have now, is to reload the data with new date formats.

I was facing some issues with loading the data due to the number of records I have, that is the reason I am looking for a solution where I do not have to reload the data again.

Thanks a lot for the reply. I shall now try reloading the data and shall get back to you if I face any further issues....

whiteline
Master II
Master II

Thanks Michael.

Nikhil, sorry for confusing.

Anyway, you can use this trick to check your data format immediately after reload.

If you post the data sample it would be easier.