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

Replace field value with a specific value in Qlik Sense script

Hi guys,

I am looking to replace customer names with a certain value (i.e. 'X') based on the condition that the delivery for the customer was done earlier than 2 years ago. Therefore, I tried the following using an if statement but it doesn't seem to work properly:

Load

OrderID,

Customer_Name,

Delivery_Date,

if(Delivery_Date < 2017.01.01, Customer_Name='*', Customer_Name) as Customer_Name,

FROM QVD;

Also, is it possible to have the date as a dynamic field: based on the loading date, to replace everything that is older than 2 years?

Thank you.

1 Solution

Accepted Solutions
sunny_talwar

So, you want to call your Customer X when Delivery_Date < 2017.01.01? try this

If(Delivery_Date < MakeDate(2017), 'X', Customer_Name) as Customer_Name_New

View solution in original post

2 Replies
sunny_talwar

So, you want to call your Customer X when Delivery_Date < 2017.01.01? try this

If(Delivery_Date < MakeDate(2017), 'X', Customer_Name) as Customer_Name_New

sunny_talwar

For a dynamic solution... you can try this

If(Delivery_Date < YearStart(Today(), -1), 'X', Customer_Name) as Customer_Name_New