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: 
straesser
Contributor
Contributor

Replacing null values in star scheme based table

Hi all,

I'm facing the following display issue for null values and hope that one of you has an idea how to solve it.

We use left keep to enrich our main data table Main with additional information Add. This gives us a star scheme (several tables with different types of additional information). Key in my example is the Factory.

Main:

RecordNoFactoryFigure
1London42
2Paris142
3Rome242
4Atlantis342
5Madrid442

Add:

FactoryAddress
LondonBuckingham Palace
ParisEiffel tower
RomeCollosseum
Madrid

There are cases where we don't have additional information in Add for a record in Main. This gives us null values.

In my example this would be for factory Atlantis.

If we now create a pivot table in the user front end showing Figure and Address Madrid would be shown as blank whereas Atlantis is shown as null in the Address column. Our customer wants us to show both in one line summing up the figures (Address = blank with Figure = 784). I have a lot of such tables so I would prefer to solve it somewhere centrally, e.g. in the load statement.

Any idea how I can set null values blank in this case?

I tried NullAsValue but without any success. I guess it's because we use the star scheme as a basis for our frontend instead of concatenating all fields into one table (for memory reasons). I also failed with any attempt of mapping because I don't find anything to map 🙂 But maybe I approached it in the wrong way.

Thanks in advance for your support,

Sabine

5 Replies
petter
Partner - Champion III
Partner - Champion III

Hi Sabine,

You could do it like this:

2018-01-12 11_05_56-QlikView x64 - [C__Users_Petter_Downloads_# QC 2018-11-12 Star Schema.qvw].png

I have attached the example application too...

straesser
Contributor
Contributor
Author

Hi Petter,

thank you for your feedback! Yes, this would work for my existing charts. Unfortunately my customer is doing own analysis using own list boxes, tables etc. And in the list boxes he is not able to select the null values. Sorry, I should have made that clear in my post. This is why I would prefer to do it somewhere centrally in the data itself. Do you have any idea?

BR

Sabine

straesser
Contributor
Contributor
Author

Btw, I don't see any attachment

petter
Partner - Champion III
Partner - Champion III

Qlik Sense is most of the time best used with a so-called Dimensional Model approach for the data.

In this respect your Main table is the fact table and the Add table is a dimension table. According to best practices in the Dimensional Modeling you should have an entry for every dimensional value that you have in your fact table in the dimension table (referential integrity). So if there are no corresponding entry in the dimension table it is important to populate it with a dummy/not existing/unknown value  that could for instance in your case say "<unkown address>" for Atlantis and should probably say the same thing for Madrid as a blank would be an unknown/unspecified address too.

Null values are more often than not a pain in the neck. So getting rid of them and rather have something more meaningful that you can actually select is better. This way you will also be able to select them in List Boxes and elsewhere in a more natural way.

You can add rows to the Add table with this extra load:

LOAD DISTINCT

  Factory,

  '(unkown address)' AS Address

RESIDENT

  Main

WHERE

  Not( Exists( Factory ) );

In the load of the Main table you can replace any blank address with the text (unknown address) too like this:

Main:

LOAD

   Factory,

   If( Trim( Address ) = '' , '(unknown address)' , Address ) AS Address,

.....

.....

;

petter
Partner - Champion III
Partner - Champion III

Don't know why you don't see any attachment - I can see it as a paperclip and document at the end of my response/comment...