Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
radupanciuc
New Contributor II

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

Re: Replace field value with a specific value in Qlik Sense script

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

2 Replies

Re: Replace field value with a specific value in Qlik Sense script

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

Re: Replace field value with a specific value in Qlik Sense script

For a dynamic solution... you can try this

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