Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlikview SQL Load IF date is filled

Hi All,

Im having a problem with something and trying to solve it for like 2 days now, without anny solutions.

What i want to create is an extra field which is filled with the date field from table VDO (if they are filled), if not i want to use the dates from Table2 (Or table1 if its easier, because they are equal).

I couldnt solve this problem because i wasn't able to use fields from other tables at once. Like use date-year from Table1 and Per-date1 from VDO at the same time.

I have this (3) tables:

TABLE1:

LOAD *,

ID & '_' & date-year & '_' & [date-month] as Key;

SQL SELECT ID,

  date-year,

  date-month

  Amount-eur,

FROM Table1;

TABLE2:

LOAD *,

  yID & '_' & yDateYear & '_' & yDateMonth as Key;

SQL SELECT yID,

  date-year as yDateYear,

  date-month as yDateMonth,

  ID_VDO

FROM Table2;

LOAD *,

  Year([Per-date1]) as VdoYear,

  Month([Per-date1]) as VdoMonth;

SQL SELECT ID_VDO,

  Per-date1,

FROM VDO;

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

  Load *,if(isnull(Per-date1) or Per-date1='',date-year, Per-date1) as New_Date ;

    SELECT a.yID,

  a.date-year as yDateYear,

  a.date-month as yDateMonth,

  a.ID_VDO,

  b.Per-date1

     From Tabl2 a, VDO b

     where a.ID_VDO = b.ID_VDO

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try like this.

     Load *;

    SELECT a.yID,

  a.date-year as yDateYear,

  a.date-month as yDateMonth,

  a.ID_VDO,

  b.Per-date1

     From Tabl2 a, VDO b

     where a.ID_VDO = b.ID_VDO

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

I succesfully connected the tables.

The thing i want is:

If date from VDO is filled then take it, if not use the date from Table2.

Kind regards,

Triglobal

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

  Load *,if(isnull(Per-date1) or Per-date1='',date-year, Per-date1) as New_Date ;

    SELECT a.yID,

  a.date-year as yDateYear,

  a.date-month as yDateMonth,

  a.ID_VDO,

  b.Per-date1

     From Tabl2 a, VDO b

     where a.ID_VDO = b.ID_VDO

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

I've got it quite working as i wanted.

The only problem right now is that I lose the results from table VDO that don't have a ID_VDO filled.

Do you have anny solution for this?

Thanks so much!!