Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dmoreno2605
Contributor III
Contributor III

Null handling in a sum

Hi everyone, i have the following code:

((sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),2))"},JobPosition={'Chofer'}>}CantidadTerminaciones)-
sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),1))"},JobPosition={'Chofer'}>}CantidadTerminaciones))/
((sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño)))"},JobPosition={'Chofer'}>}total DiferenciaFecha)+
sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),2))"},JobPosition={'Chofer'}>}total DiferenciaFecha))/2))+

((sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),3))"},JobPosition={'Chofer'}>}CantidadTerminaciones)-
sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),2))"},JobPosition={'Chofer'}>}CantidadTerminaciones))/
((sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),2))"},JobPosition={'Chofer'}>}total DiferenciaFecha)+
sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),3))"},JobPosition={'Chofer'}>}total DiferenciaFecha))/2))+

((sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),4))"},JobPosition={'Chofer'}>}CantidadTerminaciones)-
sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),3))"},JobPosition={'Chofer'}>}CantidadTerminaciones))/
((sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),3))"},JobPosition={'Chofer'}>}total DiferenciaFecha)+
sum({<FechaNumericaUSA={"<=$(vFecha)"},FechaUSA={"<$(=Makedate($(vAño),4))"},JobPosition={'Chofer'}>}total DiferenciaFecha))/2))+...

Each one of this blokes of code represents a month (i have one for every month)

This code gets the turnover% per month and sums it, the problem is that i get null when there were no events (hire/fire-left)

So at the end, i get something like Jan 2/ Feb 4/ Mar-/ Apr/1/...

2+4+null+1=error 

Do you have any idea about how to handle those null values? 

 

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

Instead of doing a+b+c... do RangeSum(a, b, c)... so in your example...2+4+null+1=error, but RangeSum(2, 4, null, 1) = 7

View solution in original post

2 Replies
sunny_talwar

Instead of doing a+b+c... do RangeSum(a, b, c)... so in your example...2+4+null+1=error, but RangeSum(2, 4, null, 1) = 7

dmoreno2605
Contributor III
Contributor III
Author

It worked, thanks!