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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
deepanshuSh
Creator III
Creator III

Re-evaluating a value obtained from a field

Hi, 

I have a problem related to app development, I have a delivery date field which is used to calculate the next approximate delivery date which works in a way that next expected should be previous delivery date + 365 days, which means that if the first delivery date for the user is 1/1/2011 the next delivery date should be 1/1/2012, giving us 1 expected delivery instance. 

I need to populate this to the current year,  i.e the user would be having 12 instances each corresponding to 1/1/2012, 1/1/2013, and so on till 1/1/2023. I am little unsure about how to achieve this. Also, I have to do this for all the user IDs. 

 

The model summary is like this...the table consists of the delivery date along with the user ID.

Any help would be appreciated. Thanks in Advance. 

Trial and error is the key to get unexpected results.
Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda

@deepanshuSh  try below

 

Load USerID,
     DeliveryDate,
     AddYears(DeliveryDate,IterNo()-1) as NextDeliveryDate
FROM Source
while AddYears(DeliveryDate,IterNo()-1) <= Today();

 

View solution in original post

2 Replies
Kushal_Chawda

@deepanshuSh  try below

 

Load USerID,
     DeliveryDate,
     AddYears(DeliveryDate,IterNo()-1) as NextDeliveryDate
FROM Source
while AddYears(DeliveryDate,IterNo()-1) <= Today();

 

deepanshuSh
Creator III
Creator III
Author

Thanku @Kushal_Chawda this what I was looking for, I was just missing the addyears function to the whole logic, +365 was not working properly.

Trial and error is the key to get unexpected results.