Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
victor_greffet
Partner - Contributor III
Partner - Contributor III

Crossing data with condition

Hi community !

I'm looking for a way to merge 2 columns depending on the title, I mean :

What I have :

Document titleBaselineDate1BaselineDate2
Document1

date

Document2date
Document 3date
....date
....date
....date
....date
Document n-1
Document ndate

What I want :

Document titleBaselineDate1BaselineDate2BaselineDate
Document1

date

date

Document2datedate
Document 3datedate
....datedate
....datedate
....datedate
....datedate
Document n-1'empty'
Document ndatedate

Knowing that when you have a date in BaselineDate1, BaselineDate2 is empty.

Furthermore it would be nice to have 'empty' for documents without date and keep the column BaselineDate1 and BaselineDate2 in my DATA

I tried with a left join and an if condition but without success,

Do you have an idea ?

Thanks !!

Victor

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

May be this

LOAD [Document title],
BaselineDate1,
BaselineDate2,
If(Len(Trim(BaselineDate1)) > 0,BaselineDate1,If(Len(Trim(BaselineDate2)) > 0,BaselineDate2,'empty')) as BaselineData
FROM
https://community.qlik.com/message/1373060
(html, codepage is 1252, embedded labels, table is @1);

Regards,

Antonio

View solution in original post

3 Replies
antoniotiman
Master III
Master III

May be this

LOAD [Document title],
BaselineDate1,
BaselineDate2,
If(Len(Trim(BaselineDate1)) > 0,BaselineDate1,If(Len(Trim(BaselineDate2)) > 0,BaselineDate2,'empty')) as BaselineData
FROM
https://community.qlik.com/message/1373060
(html, codepage is 1252, embedded labels, table is @1);

Regards,

Antonio

kenphamvn
Creator III
Creator III

Hi

Did you try left join and If condition in the one statement?

Please try this

1: Using left join to merger 2 table in to one with 2 column BaselineDate1, BaselineDate2

2: using if condition

if(len(BaselineDate1)>0,BaselineDate1,

if(len(BaselineDate2)>0,BaselineDate2,'Empty')) as BaselineDate

Regards

victor_greffet
Partner - Contributor III
Partner - Contributor III
Author

It work too,

Many thanks,

Regards