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: 
andreacossu1
Contributor
Contributor

$ sign expansion for dates

I have a simple table with 3 columns:

Date 1 containing dates

Date 2 containing different dates

ChosenDate containing either the value Date1 or Date 2.

 

For each record I would like to see a field called NewDate which is either Date1 or Date2 depending on the value in ChosenDate.  Currently I tried $(ChosenDate) as NewDate but no luck.  Any suggestions?

12 Replies
rwunderlich
MVP
MVP

I think this will work:

Data:
LOAD *, RecNo() as Key INLINE [
ChosenDate, Date1, Date2, Date3
Date1, 100, 200, 300
Date2, 101, 201, 301
Date3, 103, 203, 303
Date2, 104, 204, 304
]
;

Choose:
LOAD
Key,
peek(peek('ChosenDate', RecNo()-1, 'Data'), RecNo()-1, 'Data') as NewDate
Resident Data
;

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

andreacossu1
Contributor
Contributor
Author

Thanks.  Unfortunately I don't have RecNo in my table, which is a complex join of other tables.

rwunderlich
MVP
MVP

RecNo() is not a field, it's a counter function. You have it. 

-Rob