Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to deal null, negative and zero values

Hi,

I've to calculate a sales percentage like this:   (Current_year_sales  -  Previous_year_sales) / Previous_year_sales

My problem is how to manage null values and/or zero. For example, how can I check if Previous_year_sales is zero or negative or null ?

The same for Current_year_Sales of course.

How can I deal this situation in order to display the right percentage value ?

Thanks in advance

1 Reply
IAMDV
Luminary Alumni
Luminary Alumni

Hi,

You can use functions like ISNULL() to check NULL values. But in your case you have three conditions and I'd do something like this...

IF(Current_year_sales > 0 AND Previous_year_sales > 0,

      (Current_year_sales  -  Previous_year_sales) / Previous_year_sales,

    Whatever you wanted to show when the condition is false)

Ideally you should tag the NULLS in the script so that you can handle them easily.

Cheers,

DV


www.QlikShare.com