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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
camila1
Contributor
Contributor

Filter by month two dates columns that are on the same table

Hi! 

I want to put only ONE filter for two date column fields. For example, in the table I have "Start Date" column and "End Date" column and I want to filter by Month and see everything that started and ended in that month.

Someone could help me with this?

Thanks!!

Labels (1)
1 Reply
MayilVahanan

Hi ,

Try like below one of the methods.

1. IntervalMatch Concept

https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPref...

 

or

2. Like below

Values:
LOAD
PrimarykeyFieldName,
"Start Date" ,
Date(Alt("End Date" , Today()-1)) as "End Date"
FROM urSource;

//Find the minimum start date
MinDate:
First 1 Load "Start Date" as MinDate Resident Values Order by "Start Date";

//For generate the date between start date and Today-1
Let vMDMinDate = Floor(Peek('MinDate'))-1;
Let vMDMaxDate = Floor(Today()-1);

Drop Table MinDate;

Join(Values)

Load Date($(vMDMinDate)+IterNo()) as Date AutoGenerate 1 While $(vMDMinDate)+IterNo() <= $(vMDMaxDate);

//Load only the date between start and end date based on key field
Inner Join (Values)
Load PrimarykeyFieldName, Date ,Month(Date) as Month, year(Date) as Year Resident Values
Where floor("Start Date") <= Floor(Date) and floor("End Date") >= Floor(Date);

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.