Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

victor_greffet
New 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

Tags (1)
1 Solution

Accepted Solutions
antoniotiman
Honored Contributor III

Re: Crossing data with condition

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

3 Replies
antoniotiman
Honored Contributor III

Re: Crossing data with condition

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
Contributor III

Re: Crossing data with condition

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
New Contributor III

Re: Crossing data with condition

It work too,

Many thanks,

Regards

Community Browser