Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 🙂
How about:
=aggr(max(Flag), ID)
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
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;