Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Sujayrsp
Contributor II
Contributor II

Flagging IDs based on a value

Hi All,

I have a requirement where for each ID and for the months selected , if the flag is '1' for any of those months then have to assign a value '1' to each ID as a new column.

Please find below sample data set for example:

Month ID Flag Desired Result
Feb'23 2434 0 1
Jan'23 2434 1 1
Feb'23 84773 0 0
Jan'23 84773 0 0

 

Please help me with the solution, thanks in advance 🙂

Labels (5)
3 Replies
BenjaminT
Partner - Creator
Partner - Creator

How about:

=aggr(max(Flag), ID)

Channa
Specialist III
Specialist III

Main:

load

Month,ID,Flag

from tbale1

left join

Load 

Month,ID,'T' as desired

from table 1 where flag1

 

load * ,if desired ='T',1,0 as desiredresult resident main

drop table main

Channa
AustinSpivey
Partner - Creator
Partner - Creator

I think Channa has the solution. Another (worse) option would be:

Load
[Month],
[ID],
[Flag]
If( [ID] = Peek([ID]), Peek([Flag]), [Flag]) as [Desired Result]

Resident [Table1]
Order By [ID], [Flag] desc;

Austin Spivey | Principal Consultant @ Arc Analytics
ArcAnalytics.co | Add me on LinkedIn