Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What's the macro

Hi All,

Please i have this data

KeyPrevKeyCreation Date
1-A11/1/2011
1-A-A1-A2/1/2011
1-A-A-A1-A-A3/1/2011
1-A-A-A-A1-A-A-A4/1/2011

And i need to add a new field which is  NewDate

so the final table have to be

KeyPrevKeyCreation DateNewDate
1-A11/1/20111/1/2011
1-A-A1-A2/1/20111/1/2011
1-A-A-A1-A-A3/1/20111/1/2011
1-A-A-A-A1-A-A-A4/1/20111/1/2011

i need the macro which calculate the NewDate according to the following Criteria:

for (i=0 ; i<count(PrevKey) ; i++)

for (j=0 ; j<count(Key) ; j++)

{

if ( PrevKey = Key)

NewDate=Min(NewDate)

else

NewDate=CreationDate

}

i.e i need for each PrevKey to be compared with the whole Key field

and when the PrevKey being compared is equal to the Key in any other row to take the minimum date of the NewDate field and to be as the NewDate

or if this is impossible i need another solution

Thanks in Advance.

1 Reply
Not applicable
Author

hi,

Please see if the attached can help you, if not i guess it can give you some direction.

Cheers.