Skip to main content
Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for 
Search instead for 
Did you mean: 
AleRods88
Contributor III
Contributor III

Intervalmatch

Hello,

I have the following table

 

SHIPPERIODSTART_DATEEND_DATEVALUE
28038452018024/2/20183/2/20193
28038452018024/2/20193/1/20204
28038452018024/1/20201/3/20201
28038452018034/2/20183/2/20193
28038452018034/2/20193/1/20204
28038452018034/1/20201/3/20201
28038452018044/2/20183/2/20193
28038452018044/2/20193/1/20204
28038452018044/1/20201/3/20201
28038452018054/2/20183/2/20193
28038452018054/2/20193/1/20204
28038452018054/1/20201/3/20201
28038452018064/2/20183/2/20193
28038452018064/2/20193/1/20204
28038452018064/1/20201/3/20201
28038452018074/2/20183/2/20193
28038452018074/2/20193/1/20204
28038452018074/1/20201/3/20201
28038452018084/2/20183/2/20193
28038452018084/2/20193/1/20204
28038452018084/1/20201/3/20201
28038452018094/2/20183/2/20193
28038452018094/2/20193/1/20204
28038452018094/1/20201/3/20201
28038452018104/2/20183/2/20193
28038452018104/2/20193/1/20204
28038452018104/1/20201/3/20201
28038452018114/2/20183/2/20193
28038452018114/2/20193/1/20204
28038452018114/1/20201/3/20201
28038452018124/2/20183/2/20193
28038452018124/2/20193/1/20204
28038452018124/1/20201/3/20201
28038452019014/2/20183/2/20193
28038452019014/2/20193/1/20204
28038452019014/1/20201/3/20201
28038452019024/2/20183/2/20193
28038452019024/2/20193/1/20204
28038452019024/1/20201/3/20201
28038452019034/2/20183/2/20193
28038452019034/2/20193/1/20204
28038452019034/1/20201/3/20201
28038452019044/2/20183/2/20193
28038452019044/2/20193/1/20204
28038452019044/1/20201/3/20201
28038452019054/2/20183/2/20193
28038452019054/2/20193/1/20204
28038452019054/1/20201/3/20201
28038452019064/2/20183/2/20193
28038452019064/2/20193/1/20204
28038452019064/1/20201/3/20201
28038452019074/2/20183/2/20193
28038452019074/2/20193/1/20204
28038452019074/1/20201/3/20201
28038452019084/2/20183/2/20193
28038452019084/2/20193/1/20204
28038452019084/1/20201/3/20201
28038452019094/2/20183/2/20193
28038452019094/2/20193/1/20204
28038452019094/1/20201/3/20201
28038452019104/2/20183/2/20193
28038452019104/2/20193/1/20204
28038452019104/1/20201/3/20201
28038452019114/2/20183/2/20193
28038452019114/2/20193/1/20204
28038452019114/1/20201/3/20201
28038452019124/2/20183/2/20193
28038452019124/2/20193/1/20204
28038452019124/1/20201/3/20201
28038452020014/2/20183/2/20193
28038452020014/2/20193/1/20204
28038452020014/1/20201/3/20201
28038452020024/2/20183/2/20193
28038452020024/2/20193/1/20204
28038452020024/1/20201/3/20201
28038452020034/2/20183/2/20193
28038452020034/2/20193/1/20204
28038452020034/1/20201/3/20201

 

What I need to do is compare if the Period is in the range Start_Date/End_Date and bring a single row per Period with the Value associated to that Period:

SHIPPERIODSTART_DATEEND_DATEVALUE
28038452018024/2/20183/2/20193
28038452018034/2/20183/2/20193
28038452018044/2/20183/2/20193
28038452018054/2/20183/2/20193
28038452018064/2/20183/2/20193
28038452018074/2/20183/2/20193
28038452018084/2/20183/2/20193
28038452018094/2/20183/2/20193
28038452018104/2/20183/2/20193
28038452018114/2/20183/2/20193
28038452018124/2/20183/2/20193
28038452019014/2/20183/2/20193
28038452019024/2/20183/2/20193
28038452019034/2/20193/1/20204
28038452019044/2/20193/1/20204
28038452019054/2/20193/1/20204
28038452019064/2/20193/1/20204
28038452019074/2/20193/1/20204
28038452019084/2/20193/1/20204
28038452019094/2/20193/1/20204
28038452019104/2/20193/1/20204
28038452019114/2/20193/1/20204
28038452019124/2/20193/1/20204
28038452020014/1/20201/3/20201
28038452020024/1/20201/3/20201
28038452020034/1/20201/3/20201

 

Is there any way to do that?

Thank you!!

2 Replies
Taoufiq_Zarra

can you elaborate how you get the second table for the first ? examples

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
MayilVahanan

Hi @AleRods88 

Try like this

Load * where Date >= START_DATE and Date <= END_DATE;
LOAD *, MakeDate(Left(PERIOD,4), right(PERIOD,2),28) as Date INLINE [
SHIP, PERIOD, START_DATE, END_DATE, VALUE
2803845, 201802, 4/2/2018, 3/2/2019, 3
2803845, 201802, 4/2/2019, 3/1/2020, 4
2803845, 201802, 4/1/2020, 1/3/2020, 1
2803845, 201803, 4/2/2018, 3/2/2019, 3
2803845, 201803, 4/2/2019, 3/1/2020, 4
2803845, 201803, 4/1/2020, 1/3/2020, 1
2803845, 201804, 4/2/2018, 3/2/2019, 3
2803845, 201804, 4/2/2019, 3/1/2020, 4
2803845, 201804, 4/1/2020, 1/3/2020, 1
2803845, 201805, 4/2/2018, 3/2/2019, 3
2803845, 201805, 4/2/2019, 3/1/2020, 4
2803845, 201805, 4/1/2020, 1/3/2020, 1
2803845, 201806, 4/2/2018, 3/2/2019, 3
2803845, 201806, 4/2/2019, 3/1/2020, 4
2803845, 201806, 4/1/2020, 1/3/2020, 1
];

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