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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
tripatirao
Creator II
Creator II

Replacing null value

Hi all

I want to replace Brandname  as OtherBrand where Brandname is null .

I want to do  this  in the script.

for exemple:

Brandname  ,Sales

abc,1000

pqr,2000

-,2500

xyz,1500

when the scrpt will load my Brandname dimension should be like below.

Brandname

abc,

pqr,

OtherBrand,

xyz

Thanks in advance....

14 Replies
Not applicable

try out

IF(len(trim(BrandName)) = 0, 'OtherBrand', BrandName) as BrandName1

this should do the job.

isNull() is not always working as you might think, because a "empty" field is not always NULL. I could be space, tab or whatever.

trim() will eliminate all space, tabs etc. an len gives you the lengths afterwards, if this is 0, then you can say for sure, its a null value in there (i thinks there is no brandname which is callde "space" --> " "

prma7799
Master III
Master III

please share some sample data.

tripatirao
Creator II
Creator II
Author

I am working for a pharmaceutical data.

I  have loaded  data from excel file.

there are so many field are present.

brandname,unitprice,shipquantity, prodctiontype.

abc,1000,20,tablet

xyz,2000,10,suspension

pqr,3000,30,capsule

blankspace,2000,40,injection

In excel file only for brandname some values are empty.

gautik92
Specialist III
Specialist III

values are null or '-'??

tripatirao
Creator II
Creator II
Author

Hi Gautam

Thanks for your time.Actually that is a empty field in excel.

The problem is solved.

I forget to use the second expression  what manual ruhi suggested.

if(len(Brandname)>0,Brandname,'OtherBrand') as Brandname,

Thanks