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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jmurrevcyc
Contributor III
Contributor III

Cross join a value with dates in a table

Hello -

In Qlik Sense, I am trying to do a cross join.

I have a table with a set of constant values for each customer that I need to populate for all distinct dates within a table. 

That table will be joined to another table that has dates. I have tried just bringing in the value, but if I have a date in my visualization the value shows as zero.

So I know if I had a table that had the constant values for each date, then it would join to the rest of my data, and return the values I desire.

So for example, the table with constant values looks like this.

jmurrevcyc_0-1674775729976.png

In the load script editor, I want to do a cross join on periods 2022-07 - 2023-06, so that the result table looks like this.

jmurrevcyc_1-1674775861743.png

I would greatly appreciate any help.

 

 

Labels (3)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

the script will be As below, 

 

FactTable:

Datefield,Dim1,Dim2

From XyzSource;

 

Values:

Load * inline [

cust_num,value

1,0.74

2,0.69

];

 

 

Left Join(Values)

Load fieldvalue('Datefield',iterno()) as Datefield

Autogenerate(1)

While len(fieldvalue('Datefield',iterno()))>1;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
vinieme12
Champion III
Champion III

the script will be As below, 

 

FactTable:

Datefield,Dim1,Dim2

From XyzSource;

 

Values:

Load * inline [

cust_num,value

1,0.74

2,0.69

];

 

 

Left Join(Values)

Load fieldvalue('Datefield',iterno()) as Datefield

Autogenerate(1)

While len(fieldvalue('Datefield',iterno()))>1;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
jmurrevcyc
Contributor III
Contributor III
Author

Thank you for helping me with this.I was able to incorporate the iterno function and got the result I needed.

 

You are a life saver!