Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to replace with NULL when there is different data in column values?

Hi,

I have to replace with NULL when there is different 'Point' for different 'number' and different 'Point' for same 'number'. How can I set this in script.

Please can anyone suggest me.

Thanks.

11 Replies
sushil353
Master II
Master II

H,

Hi,

Can u share some sample data

Not applicable
Author

Please see attached.

PrashantSangle

Hi,

Create Flag in script and use that flag in your set analysis.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Thanks. can you suggest how to create flag and proceed with set analysis please?

vikasmahajan

PFA

vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This code will create the flag field (assuming ID is a unique key for the data):

// Get the number values that are associated with more than one distinct Point value

T_Numbers:

LOAD number,

  Count(ID) As Rows,

  Count(DISTINCT Point) As Count,

  Concat(DISTINCT ID, '|') As IDList

Resident Data

Group By number;

// Get the Point values that are associated with more than one distinct number value

T_Points:

LOAD Point,

  Count(ID) As Rows,

  Count(DISTINCT number) As Count,

  Concat(DISTINCT ID, '|') As IDList

Resident Data

Group By Point;

// Get the list of IDs that need to be flagged

T_Flag:

LOAD SubField(IDList, '|') As ID

Resident T_Numbers

WHERE Rows >= 2 And Count >= 2;

// Get the list of IDs that need to be flagged

Concatenate(T_Flag)

LOAD SubField(IDList, '|') As ID

Resident T_Points

WHERE Rows >= 2 And Count >= 2;

// Add the flag field to your data table (1 = flag, null = no flag)

Left Join (Data)

LOAD ID,

  1 As Flag

Resident T_Flag;

// Clean up

DROP Table T_Numbers, T_Points, T_Flag;

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jyothish8807
Master II
Master II

Can you please explain your requirement a bit more.

Regards

KC

Best Regards,
KC
Not applicable
Author

Thanks. I checked it. I need when there is same point the point should appear in column. when there is different point for same number It should replace with NULL

see please output and I need like this


name


number


point


output
  point


XX


0.01


L1003647


NULL


XX


0.01


L763753


NULL


XX


11.81


L1003647


L1003647


XX


49.64


L1003647


L1003647


XX


10.94


L1003647


NULL


XX


10.94


L61437


NULL

would it be possible?

Not applicable
Author

Thanks.

I have to replace with NULL when there is different 'Point' for different 'number' and different 'Point' for same 'number'.  and when it is same point for different number the point should remain as it is. would it be possible


name


number


point


output
  point


XX


0.01


L1003647


NULL


XX


0.01


L763753


NULL


XX


11.81


L1003647


L1003647


XX


49.64


L1003647


L1003647


XX


10.94


L1003647


NULL


XX


10.94


L61437


NULL