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: 
Not applicable

Flag rows based on another field value

Hi everyone,

I am interested in looking at sets of rows with common account numbers, and assigning a 1 to a field in these rows if another field is true in any of these rows. To be more specific, I have fields called [Account Number], [field1] and [Production Date] - there are several rows for each Account Number since there's one for each production date. I need to figure out an efficient way to determine if field1 is ever true for each Account Number's set of rows and if so, I would like to assign a 1 to a field2 for every single one of those account numbers.

Basically this would flag every row for each Account Number that once contained a 1 in field1. Does anybody know how this could be done in the script or in the actual worksheet?

Thank you.

1 Solution

Accepted Solutions
Not applicable
Author

I believe this is what you are looking for.

The expression will be like : field2=rangesum(above(if(aggr(max ( f1),Ano)=1,1,0),0,RowNo())).

I have attached the sample I used to come up with the result.

I ahve a productiondate, f1 (field1) and Ano (AccountNo). You can see the field 2 result in the chart,

Please let me know if this helps.

View solution in original post

1 Reply
Not applicable
Author

I believe this is what you are looking for.

The expression will be like : field2=rangesum(above(if(aggr(max ( f1),Ano)=1,1,0),0,RowNo())).

I have attached the sample I used to come up with the result.

I ahve a productiondate, f1 (field1) and Ano (AccountNo). You can see the field 2 result in the chart,

Please let me know if this helps.