Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Not applicable

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

View solution in original post

11 Replies
Highlighted
Anonymous
Not applicable

could you post some sample data please , English prefered

Highlighted
Not applicable

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

Highlighted
Creator
Creator

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

Highlighted
Not applicable

My fields are declared like this :

Capture3.PNG

Highlighted
Not applicable

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é])

Highlighted

Does Année1 & Mois1 are related each??

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
Not applicable

They aren't related

Highlighted
Not applicable

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

Highlighted
Not applicable

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