Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
peterstalberg
Contributor III
Contributor III

How to find the first value before a date offset?

Hi Folks,

I have a list of products changing price over time, se example below. Now I want to list/analyse the current price 180 days after the initial listing only.

An elegant(?) solution for this would be highly appreciated. Thanks//Peter

INPUT TABLE

PRODUCTPRICEDATE
PRODUCT A15 0002011-09-07
PRODUCT A25 0002011-11-30
PRODUCT A75 0002012-06-28
PRODUCT A165 0002014-10-14
PRODUCT A200 0002014-11-10
PRODUCT A130 0002015-06-23
PRODUCT B5 0002018-01-19
PRODUCT B15 0002018-05-19
PRODUCT B22 0002019-01-07

 

OUTPUT TABLE (<=180 days from initial listing)

PRODUCTPRICEDATE 
PRODUCT A25 0002011-11-30
PRODUCT B15 0002018-05-19

 

Labels (1)
4 Replies
NitinK7
Specialist
Specialist

Hi peter 

PRODUCTPRICEDATE
PRODUCT A15 0002011-09-07

 

your  product A initial date is 2011-09-07 then you want after 180 days of initial date

so date should be 2012-05-12 but your output table is 2012-06-28 for product A and same as Product B

please confirm

peterstalberg
Contributor III
Contributor III
Author

oops! My mistake fiddling with the dates. I have updated the example accordingly. Yes, it is the current price at 180 days after the initial listing . Hope it is clearer now. Thanks//Peter

NitinK7
Specialist
Specialist

Hi 

try this


ABC:
LOAD PRODUCT,
PRICE,
DATE
FROM
[Try and Error\first value after 180.xlsx]
(ooxml, embedded labels, table is Sheet1);

Inner Join
PQR:
LOAD PRODUCT,

Date( FirstSortedValue(DATE,DATE)+180) as DATE
Resident ABC
Group by PRODUCT;

first value after 180.PNG

peterstalberg
Contributor III
Contributor III
Author

Hi NitinK7,

Thank you very much for your proposed solution. This seems to work within the script but, if possible,  I was rather looking for a solution as a Chart Function within the app. Do you think there is one? Rgds//Peter