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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
seband_fredes
Contributor II
Contributor II

How I add a constant in a table?

Hi everyone, i'm looking for a solution in this case:

I have this table:

Sales:

Load

 sales,

customer,

location

FROM ...;

Example:
[Sales-Customer-Location

100       A                    MIT

200       b                   NY]

Previously I calculate the workdays of the last three months, and i sum this days and save it in a field. I save this result in this table:

workdays:

load

Sum(workdays) as workdays_sum

from ...;

Example:
[workdays_sum

  62]

 

When I use Concatenate function, the result is this:

[Sales-Customer-Location-workdays_sum

100       A                    MIT            -

200       b                   NY              -

-             -                     -                62] 

 

Who is the best way to have this result:

[Sales-Customer-Location-workdays_sum

100       A                    MIT            62

200       b                   NY              62] 

 

I apretiate all comments and help.

Thanks

1 Solution

Accepted Solutions
rubenmarin

Hi, you can do an outer join , which will create a cartesian products between all values in both tables:

 

Outer Join (Sales)
load
Sum(workdays) as workdays_sum
from ...;

 

 

Another option is to load days in a variable:

 

LET vWorkDays = Peek('workdays_sum',0,'workdays');

 

And use this variable on LOAD:

 

Load
  sales,
  customer,
  $(vWorkDays) as workdays_sum,
  location
FROM ...;

 

 

 

View solution in original post

2 Replies
rubenmarin

Hi, you can do an outer join , which will create a cartesian products between all values in both tables:

 

Outer Join (Sales)
load
Sum(workdays) as workdays_sum
from ...;

 

 

Another option is to load days in a variable:

 

LET vWorkDays = Peek('workdays_sum',0,'workdays');

 

And use this variable on LOAD:

 

Load
  sales,
  customer,
  $(vWorkDays) as workdays_sum,
  location
FROM ...;

 

 

 

seband_fredes
Contributor II
Contributor II
Author

Gracias Ruben, muy util tu ayuda.

 

Saludos