Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
BSCIknowlec
Contributor III
Contributor III

Count from date to next 5, 10, 14 days

hey guys hoping i can get some help,

i have a date column named [Discard Date]with future dates. I need to include a new column where it takes the [discard date] and will tell me in a new column how many days each date is until it hits "discard". 

discard = todays date.  i currently have them set out where if the discard date is within 5 days, the column turns red, if discard date is within 5-10 days column turns yellow and if discard date is between 10-14 days, column turns green(see below code and screenshot): 

Discard:
load *,
if([discard_date] -today() >=0 and [discard_date] -today() <=5, dual('<=5 Days',1),
if([discard_date] -today() >=5 and [discard_date] -today() <=10, dual('5-10 Days',2),
if([discard_date] -today() >=10 and [discard_date] -today() <=14, dual('10-14 Days',3)))) as [Pallet Discard];

 

however, is there a way to get a new column where it will be "days left till discard"? 

thank you,Ciarán

 

Discard Date.JPG

Labels (2)
1 Solution

Accepted Solutions
rubenmarin

Hi you can use an expression like: [discard_date] -today() 

Or if you want to make selections on that vaue you can create another field to have that value precalculated:

Discard:
load *,
[discard_date] -today() as [Days left till discard],
if([discard_date] -today() >=0 and [discard_date] -today() <=5, dual('<=5 Days',1),
if([discard_date] -today() >=5 and [discard_date] -today() <=10, dual('5-10 Days',2),
if([discard_date] -today() >=10 and [discard_date] -today() <=14, dual('10-14 Days',3)))) as [Pallet Discard];

View solution in original post

1 Reply
rubenmarin

Hi you can use an expression like: [discard_date] -today() 

Or if you want to make selections on that vaue you can create another field to have that value precalculated:

Discard:
load *,
[discard_date] -today() as [Days left till discard],
if([discard_date] -today() >=0 and [discard_date] -today() <=5, dual('<=5 Days',1),
if([discard_date] -today() >=5 and [discard_date] -today() <=10, dual('5-10 Days',2),
if([discard_date] -today() >=10 and [discard_date] -today() <=14, dual('10-14 Days',3)))) as [Pallet Discard];

View solution in original post