Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

[QlikView] How to select a date between two dates

Hello,

I would like to select from a list of selection a date. This selected date would then allow me to display the start date of the contract and the date of end of contract. So, we have a date interval in which our selected date must be included. I use "set analysis" but it does not work ".

Capture.PNG

=Sum({$

<[Année début de validité] = {">=$(=Année1)"}>*

<[Année fin de la période de validité] = {"<=$(=Année1)"}>*

<[Mois début de validité] = {">=$(=Mois1)"}>

*<Mois1 = {"<=$(=[Mois fin de la période de validité])"}>

} [Début de validité])

1 Solution

Accepted Solutions
Not applicable

Re: [QlikView] How to select a date between two dates

Ok, i have a correct answer. I have used some MakeDate function to regroup my field Year and Month together and compare them to my date with this setAnalysis :

=Sum({$ <YMD = {"<=$(=YM)"}> * <YMF = {">=$(=YM)"}>} [Début de validité])

Lexique : YMD : Year,Month,Début;     YMF: Year,Month,Fin and YM: Year,Month

Have a nice day,

Alex

11 Replies
roharoha
Valued Contributor III

Re: [QlikView] How to select a date between two dates

could you post some sample data please , English prefered

Not applicable

Re: [QlikView] How to select a date between two dates

Capture2.PNG

I want that from the date(Année, Mois) I select from the two bars at the top, qlikview displays me all entries where this date is between  "debut de validite" and "fin de la période"

This code work to to find by year :

=Sum({$

<[Année début de validité] = {">=$(=Année1)"}> /

<[Année fin de la période de validité] = {"<=$(=Année1)"}>} [Début de validité])

But i want a selection by Years AND Months. There isn't any relation between the two bars at the top and the list at the bottom.

Thanks for your help

prachisangewar
Contributor

Re: [QlikView] How to select a date between two dates

Hi,

Instead of the two blocks (one for Year and one for Month) you can create two calendar objects to Select the Start Date and End Date.

You can go through the below video for the steps.

Selecting Arbitrary Date Ranges

Not applicable

Re: [QlikView] How to select a date between two dates

My fields are declared like this :

Capture3.PNG

Not applicable

Re: [QlikView] How to select a date between two dates

In SQL language, my request will be :

SELECT * from [début de validité], [Fin de la période de validité] where Année1>=[Année début de validité] AND Année1<=[Année fin de la période de validité] -> (Select * where Mois1>=[Année début de validité] AND Mois1<=[Mois fin de la période de validité])

Re: [QlikView] How to select a date between two dates

Does Année1 & Mois1 are related each??

Not applicable

Re: [QlikView] How to select a date between two dates

They aren't related

Not applicable

Re: [QlikView] How to select a date between two dates

Ok thanks, let's see how to create calendar objects, thanks

Not applicable

Re: [QlikView] How to select a date between two dates

I think calendar object can't help me because i want the user have only to clik on a Year or a Month to display the result, it's faster for the user