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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
venkat1
Creator II
Creator II

Picking updated date field from data

Hello all,

Please help me out from this logic,I am showing branch wise sales by taking Date-1 for calendar,Logic here i should apply here is If "Date-2" having  "-"  then i should take from Date-1 else i should consider a date from Date-2.
 
Branch    Date-1                    Date-2           Sales
A                14-06-2019             -                       1600
B                15-09-2015             -                       18000
C                12-04-2018        10-03-2017       3651
D                16-01-2015             -                       648
E                 02-05-2016       08-04-2017       5648

Labels (1)
2 Solutions

Accepted Solutions
Taoufiq_Zarra
MVP
MVP

if(len([Date-2])<2,[Date-1],[Date-2]) as New_Date2,
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

Vegar
MVP
MVP

Is your empty - values actually the string "-"  or is it just Qlikview that is presenting NULL values as -.

If they are NULL values then you can use the Alt() function

Alt([Date-2],[Date-1]) as Date

If its not null, but a string, then use the if solution suggested by @Taoufiq_Zarra .

View solution in original post

2 Replies
Taoufiq_Zarra
MVP
MVP

if(len([Date-2])<2,[Date-1],[Date-2]) as New_Date2,
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Vegar
MVP
MVP

Is your empty - values actually the string "-"  or is it just Qlikview that is presenting NULL values as -.

If they are NULL values then you can use the Alt() function

Alt([Date-2],[Date-1]) as Date

If its not null, but a string, then use the if solution suggested by @Taoufiq_Zarra .