Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
amien
Specialist
Specialist

Creating 0 value for each hour

I have 1 table with three colums:

%Id, Zone,Hour

0, A, 10

1, A, 11

2, A, 12

3, B, 1

3, B, 2

etc

In my bar chart i have:

dim: Hour

exp : Count(%Id)

Now i want a 0 for each hour

So for Zone A, Where Hour = 10,11,12 there is a 1, the rest of the hours (all 24) have a zero.

I know you need to add a zero for each dim.

For i would do something like this:

t2:

LOAD Distinct

Zone

Resident t1

Outer Join

LOAD Distinct

Hour

0

Resident t1;

And then concatenate t2 to t1.

Note: Hour has every needed value (0..23)

This works..

But the thing is that my source is a huge table with alot of selectable dims. Isn't there a more easy way to do this?

3 Replies
sunny_talwar

I don't think there is an easy way out here:

Generating Missing Data In QlikView

amien
Specialist
Specialist
Author

Thanks, but i don't really see how this helps? i could 0 values for each hour, but the problem is that i can't concatenate my fact table. Is it possible to fix this by adding a separate fact table?

Sergey_Shuklin
Specialist
Specialist

Hello!

Not sure if it will be suitable for your task, but you can create a sample table which will contain all your needed distinct values like:

A,0

A,1

A,2

...

A,23

B,0

B,1

B,2

...

Z,23

Then you need to create an unique key (connection) with your main huge data table. This is actualy a common way to implement such tasks. Hope it will help!