Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
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
Luminary Alumni
Luminary Alumni

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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

4 Replies
kaushiknsolanki
Luminary Alumni
Luminary Alumni

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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
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
Luminary Alumni
Luminary Alumni

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

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

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!!