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: 
djaykumar
Contributor
Contributor

How to assign same values to Nulls which is having primary key in Qlikview script while loading

Hi,

I am facing some issue with the following . I am having data set like

Customer_ID             Department

Customer1                  Finance

Customer1                     -              

Customer2                  HR

Customer2                    -      

Customer3                      -                

In the above data set    for Customer1  and Customer2 where the Department is empty I have to assign Finance and HR.

And in the same way for Customer3 I have to assign 'Not Assigned' in the Department field. 

This is one scenario and there are thousands of customers and around 30 Departments are there.

Please help me in this.

Thanks

Jay

 

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try this?

 if(Customer_ID   =previous(Customer_ID  ) and len(trim(Department))=0, peek('DepartmentFull'),if(len(trim(Department))=0,'Not Assigned', Department)) as DepartmentFull

 

View solution in original post

4 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

you can add to your load script this expression: 

LOAD Customer_ID   ,

          Department,

          if(Customer_ID   =previous(Customer_ID  ) and isnull(Department), peek('DepartmentFull'),Department) as DepartmentFull

From 

djaykumar
Contributor
Contributor
Author

Hi lironbaram,

Thanks for quick reply.

But Its not working . I am getting blanks(-) only

Please help me.

Thanks

Jay

 

tresesco
MVP
MVP

Try this?

 if(Customer_ID   =previous(Customer_ID  ) and len(trim(Department))=0, peek('DepartmentFull'),if(len(trim(Department))=0,'Not Assigned', Department)) as DepartmentFull

 

djaykumar
Contributor
Contributor
Author

Hi Tresesco,

Now its working,

Thanks,

Jay