Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
evgeniystuchalk
Partner - Creator II
Partner - Creator II

Make zeroes instead of null, while making left join

Hi!

i'm left-joining two tables, like

IdStuff
1a
2b
3c

IdMeasure
111
222

Result what i get is like:

IdStuffMeasure
1a11
2b22
3c-

Resul what i want is:

IdStuffMeasure
1a11
2b22
3c0

how i can achieve it?

1 Solution

Accepted Solutions
sunny_talwar

Try doing this in the resident table using the Alt() function:

Table:

LOAD Id,

     Stuff

FROM

[https://community.qlik.com/thread/214576]

(html, codepage is 1252, embedded labels, table is @1);

Left Join(Table)

LOAD Id,

     Measure

FROM

[https://community.qlik.com/thread/214576]

(html, codepage is 1252, embedded labels, table is @2);

FinalTable:

NoConcatenate

LOAD Id,

  Stuff,

  Alt(Measure, 0) as Measure

Resident Table;

DROP Table Table;


Capture.PNG

View solution in original post

4 Replies
sunny_talwar

Try doing this in the resident table using the Alt() function:

Table:

LOAD Id,

     Stuff

FROM

[https://community.qlik.com/thread/214576]

(html, codepage is 1252, embedded labels, table is @1);

Left Join(Table)

LOAD Id,

     Measure

FROM

[https://community.qlik.com/thread/214576]

(html, codepage is 1252, embedded labels, table is @2);

FinalTable:

NoConcatenate

LOAD Id,

  Stuff,

  Alt(Measure, 0) as Measure

Resident Table;

DROP Table Table;


Capture.PNG

MK_QSL
MVP
MVP

T1:

LOAD Id,

     Stuff

FROM

[https://community.qlik.com/thread/214576]

(html, codepage is 1252, embedded labels, table is @1);

Left Join

LOAD Id,

     Measure

FROM

[https://community.qlik.com/thread/214576]

(html, codepage is 1252, embedded labels, table is @2);

NoConcatenate

Final:

Load

  Id,

  Stuff,

  If(IsNull(Measure) or Len(Trim(Measure)) = 0,0,Measure) as Measure

Resident T1;

Drop Table T1;

swuehl
MVP
MVP

Don't join - use Applymap instead

ApplyMap() also allows a third parameter to define the default value (0 in your case).

evgeniystuchalk
Partner - Creator II
Partner - Creator II
Author

Yes, it works ) Also, Alt(Measure, 0) as Measure is much better than If(IsNull(Measure) or Len(Trim(Measure)) = 0,0,Measure) as Measure