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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
creepingdeath
Contributor II
Contributor II

Count empty rows using aggregation

 

I want to count rows where Technique_Detection is empty group by Numero_Sillon, Type_Horaire Technique_Detection

creepingdeath_0-1610126220546.png

This was the expression I used :

count(Aggr(count( {<Technique_Detection={'GNSS','Localisateur','ObservationManuelle'}>} Technique_Detection),Date_Circulation,Numero_Sillon,CR_CI_CH,Type_Horaire))

 

and this is the unexpected result that I want to avoid.

creepingdeath_1-1610126382393.png

Jalons Couverts : is the number of rows covered by "Technique_Detection" and should be 0 in this case

Total_Jalons : is the total calculated by this expression : count(TOTAL Aggr(count(Ordre),Date_Circulation,Numero_Sillon,CR_CI_CH,Type_Horaire))

Taux_de_couverture: is the coverage pourcentage wich should be 0%

 

Thanks in advance.

 

Labels (4)
2 Solutions

Accepted Solutions
edwin
Master II
Master II

a simple solution would be to add an EMPTY flag or count in your script:

load ...
if(isnull(Technique_Detection ),1) as BlankTech,
...

this way it will be a simple SUM(BlankTech) to get all blank values for that field instead of creating a complex expression

View solution in original post

edwin
Master II
Master II

if the field is blank and you count it - it will return 0, so in your statement 

Jalons Couverts : is the number of rows covered by "Technique_Detection" and should be 0 in this case

there is something else going on, if you can show your expression for this, it would be helpful.

another way of counting nulls is this:

if you have Product and Type, and you want to count products with null TYpes:

count(Product) -all products
count(Type={"*"}Product) - all prpoducts with NON NULL types
count(Product) - count( Type={"*"}Product) - all products with NULL Types


View solution in original post

4 Replies
creepingdeath
Contributor II
Contributor II
Author

Any help ?

edwin
Master II
Master II

a simple solution would be to add an EMPTY flag or count in your script:

load ...
if(isnull(Technique_Detection ),1) as BlankTech,
...

this way it will be a simple SUM(BlankTech) to get all blank values for that field instead of creating a complex expression

edwin
Master II
Master II

if the field is blank and you count it - it will return 0, so in your statement 

Jalons Couverts : is the number of rows covered by "Technique_Detection" and should be 0 in this case

there is something else going on, if you can show your expression for this, it would be helpful.

another way of counting nulls is this:

if you have Product and Type, and you want to count products with null TYpes:

count(Product) -all products
count(Type={"*"}Product) - all prpoducts with NON NULL types
count(Product) - count( Type={"*"}Product) - all products with NULL Types


edwin
Master II
Master II

there will of course be a few other ways to do it and some may apply to your specific need based on your business rules and some may not.