Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to identify and empty/null cell in script??

Hello!

Well I have this problem I am doing a distribution of general cost based on the actual cost of products, that means I calculate a distribution percentage in every data entry, and then I multiply this percentage by the amount to distribute.

It is simple, but my problem comes when I add up the actual cost of the products to the resulting on the already explained expression, my idea is that I must use an "if" function, to tell my script to not add up the result to the actual cost, when the result is in fact an empty cell, but I do not know how to say that, something like:

IF( result='blank',actualcost,actualcost+result) as finaldist

'blank' does not exists apparently, and that is my problem, the table looks like this:

productactualcostgeneralcostperecentageresultfinaldist
A1005000.12562.5562.5
B2005000.2550250
C400-0.5--
D1005000.12562.5162.5

THANK YOU!

2 Replies
maxgro
MVP
MVP

there is a isnull() function

or you can try with

IF( len(trim(result))=0,actualcost,actualcost+result) as finaldist

another one

rangesum(actualcost, result) as finaldist



I suppose all your fields are in one table

Not applicable
Author

Yep, all my fields are inside one single table. And it actually worked, thank you this other one also makes the trick:

If(isnull(PORCIONALL2),CTOAGGR2, PORCIONALL2+CTOAGGR2) as DISTFINALALLPROD