Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
sushantk19
Creator
Creator

Generating the range of months between 2 months

hello,

I have the below scenario:

my data looks something like this

Cust 1 startdate 1 end date1

Cust1 Startdate 2 enddate2

123 201803 201907

123 201909 202003

Basically there is a gap of few months between enddate1 and startdate2.

The output expected is range of month-year from startdate1 to enddate1 and then again from startdate2 to end date2.

123 201803

123 201804

|. . |

123 201906

123 201909

| |

123 202003

Is there a way to generate this kind of output in redshift database or implement this logic through Talend components?

Labels (3)
1 Solution

Accepted Solutions
Mahamoutou
Contributor III
Contributor III

You can use the following steps to get the job done :

(For testing purposes I had added a third line in the input data. I removed this line before taking screenshots)

 

0695b00000N28wJAAR.png 

0695b00000N28wdAAB.png0695b00000N28wiAAB.png0695b00000N28wsAAB.png0695b00000N28x7AAB.png0695b00000N28xCAAR.png0695b00000N28xHAAR.png0695b00000N28xRAAR.png 

I hope that answers your question..

View solution in original post

3 Replies
gjeremy1617088143

Hi, via talend you could use this :

if input are String

TalendDate.diffDate(TalendDate.parseDate("yyyyMM",(String of start date)), TalendDate.parseDate("yyyyMM",(String of end date)), "MM")

if input are date :

TalendDate.diffDate(start date),(end date), "MM")

Send me love and kudos

sushantk19
Creator
Creator
Author

@guenneguez jeremy​ : Hello, I need the list of months between the 2 dates.,not the number of months. Is there a way in redshift ot get this?

Mahamoutou
Contributor III
Contributor III

You can use the following steps to get the job done :

(For testing purposes I had added a third line in the input data. I removed this line before taking screenshots)

 

0695b00000N28wJAAR.png 

0695b00000N28wdAAB.png0695b00000N28wiAAB.png0695b00000N28wsAAB.png0695b00000N28x7AAB.png0695b00000N28xCAAR.png0695b00000N28xHAAR.png0695b00000N28xRAAR.png 

I hope that answers your question..