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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Vaibhav2
Contributor II
Contributor II

Date range from Start date and end date

I have coupon codes information along with their start dates and end dates in separate columns. The three fields are coupon code, start date, end date. I want to create a calendar where if a user selects a particular date or a date range, all the coupon codes which have at-least 1 day of the selected range in between the start date and end date should be selected.  Anyone knows how to do this?

Labels (4)
2 Replies
nevopotokcloudinary

You can create a new field called - date which contains all date values (start & end date) and then use this field as a calendar and store in a variable the max and min date (based on user selection) and add it in Set-Analysis

variables:
let vMaxDate =Max(date);
let vMidDate =Mid(date);


nevopotokcloudinary_0-1643700594174.png

 





coupon_date:
Load * Inline [
couponcode, startdate, enddate
1 ,01/01/2022,01/02/2022
2 ,01/01/2022,01/05/2022
3 ,01/03/2022,01/31/2022
4 ,01/01/2022,01/14/2022
5 ,01/23/2022,01/25/2022
6 ,01/05/2022,01/20/2022
];

Load startdate as date Resident coupon_date;
Load enddate as date Resident coupon_date;

Expression:
Only({=$(vMinDate)"}>}startdate)
Only({=$(vMinDate)"}>}enddate)

Vaibhav2
Contributor II
Contributor II
Author

Hey, I understood the idea but there is something wrong with the expression to be used as dimensions in the table. Can you check and rewrite them once.