Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Freazord
Contributor
Contributor

Create a table counting Null values from another Table

Hello,
I am currently working on importing a table from Salesforce and I would like to create a table, alongside the imported table, that would calculate the number of empty values for each column of the imported table.
The complexity lies in the fact that my columns all have different names that do not follow a numerical logic (For example: Number of dogs per family, Name of the family, Average age of the family, Region, etc...).
I have not found a solution that would allow me to do this. Do you have any solutions?

To illustrate, here is a fictitious example of what I have and what I would like to achieve:

 

Table imported from SF :

Freazord_0-1665647917327.png

Table of NullCount for each column :

Freazord_2-1665648096526.png

 

Thank you in advance for your help 😊

 

Labels (1)
5 Replies
MendyS
Partner - Creator III
Partner - Creator III

Hi @Freazord 

you have a couple of options, depending on the amount of data and stuff like that,

try this -

TmpTable:

NoConcatenate

if(Len([NameOfCol]<1),'Flag') as [TmpNameOfCol] (do that for all Col the you have) resident...
and after that 

Tmp2Table: 

NoConcatenate
Count (TmpNameOfCol) as ...

 

Freazord
Contributor
Contributor
Author

Hello @MendyS ,

Thank you for your answer.


However, I am looking to perform the calculation of NULL values for each column dynamically.
Currently having 33 columns in my test sample, I plan to extend this practice to a table with 100+ columns that tends to grow over time.


The goal is also to allow my colleagues to just add a column in the LOAD of the SF table without having to touch the LOAD of the NULL table.

 

MendyS
Partner - Creator III
Partner - Creator III

Hi @Freazord 

look at this article 

Solved: Dynamic Column Names in Load Script - Qlik Community - 1096826

inside the generic load, you can calculate the null value, 

tell me if it helps you

sidhiq91
Specialist II
Specialist II

@Freazord  Please follow the below below script in the load script Editor.

NoConcatenate
Temp:
load emptyisnull(Numberofdogsperfamily) as Numberofdogsperfamily,
emptyisnull(Nameofthefamily) as Nameofthefamily,
emptyisnull(AverageAgeofthefamily) as AverageAgeofthefamily,
emptyisnull(City) as City
inline [
Numberofdogsperfamily,Nameofthefamily,AverageAgeofthefamily,City
2,Johnson,26,New York
1,Smith,,
,Richardson,,Paris
,Clark,23,,
];

NoConcatenate
Temp1:
Load if(isnull(Numberofdogsperfamily),'Null',Numberofdogsperfamily) as Numberofdogsperfamily,
if(isnull(Nameofthefamily),'Null',Nameofthefamily) as Nameofthefamily,
if(isnull(AverageAgeofthefamily),'Null',AverageAgeofthefamily) as AverageAgeofthefamily,
if(isnull(City),'Null',City) as City

Resident Temp;

Drop table Temp;

Exit Script;

In the front End:

sidhiq91_0-1665661385176.png

 

Freazord
Contributor
Contributor
Author

Hi @MendyS ,

I checked the link you sent me and read the entire post as well as the resources related to this post.

Unfortunately, I didn't see any point about calculating null values in each column of a table.

Did I miss an important information?

Maybe I didn't express what I'm looking for well, I'm recontextualizing my request.

The point is:
From a source table containing a number X of columns that can evolve and each having a different not normalized name, I want to create a dynamic table having a column for each column of the source table displaying the number of null fields contained in a column.

Don't hesitate to tell me if my request is not clear, I will simulate a larger table with the expected result;

I thank you again for all your help and the time you spend to help me.