Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
VishalWaghole
Specialist II
Specialist II

how to fetch value from another table if respective table contain zero value

Hi community,

My scenaria is, I have two table with 2 column in each table.

table 1 having columns, id and production

table 2 having columns, id and actual production

and my requirment is, if my production value in table 1 is zero or - then fetch this value from table 2 from actual production column..

Could any one plz help me for this.

Thanks and Regards,

Vishal Waghole

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

Table1:
LOAD Id,
     production
FROM
D:\Community\test116A.xls
(biff, embedded labels, table is [table1$]);

Left Join(Table1)
LOAD Id,
     [actual production]
FROM
D:\Community\test116A.xls
(biff, embedded labels, table is [table2$]);


Table2:
Load Id as ID,if(IsNull(production) or production = 0 or production = '-',[actual production],production) as production,[actual production] Resident Table1;

Drop table Table1;

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

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

Table1:
LOAD Id,
     production
FROM
D:\Community\test116A.xls
(biff, embedded labels, table is [table1$]);

Left Join(Table1)
LOAD Id,
     [actual production]
FROM
D:\Community\test116A.xls
(biff, embedded labels, table is [table2$]);


Table2:
Load Id as ID,if(IsNull(production) or production = 0 or production = '-',[actual production],production) as production,[actual production] Resident Table1;

Drop table Table1;

Regards,

Kaushik Solanki

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

see the attached file

mdmukramali
Specialist III
Specialist III

Dear,

kindly find the attachment.

hope it will help you.

Thanks,

Mukram

Not applicable

HI, try the below code

Tab1:

LOAD * Inline

[

ID , Production

1,200

2,340

3,

];

Left Join

Tab2:

LOAD * Inline

[

ID , ActualProduction

1,230

3,450

];

NoConcatenate

Result:

LOAD ID , if(len(Production)=0, ActualProduction , Production) as  Production

Resident Tab1;

DROP Table Tab1;

//yusuf

swuehl
MVP
MVP

You can create a chart with dimension Id and this as expresssion:

=if(production=0 or production='-', [actual production],production)

You can also use a similar expression in your load script:

RESULT:

LOAD *,

     if(production=0 or production='-', [actual production],production) as ResultProduction

Resident Table1;

drop table Table1;

Not applicable

Hi .

Check this.. Its might not be optimized solution.. But its will solve ur problem.

Karthik

VishalWaghole
Specialist II
Specialist II
Author

Thank You kaushik

Its working fine...