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: 
raadwiptec
Creator II
Creator II

if

hi

i have the following required in expression.. i have 3 columns

closing date

last date

opening date

My condition is as below

if closing date is blank or null the take the date from opening date column ,if the opening date is null or blank then take the date from last date column

21 Replies
sunny_talwar

May be like this:

If(Len(Trim([Closing Date])) > 0, [Closing Date],

If(Len(Trim([Opening Date])) > 0, [Opening Date], [Last Date]))

raadwiptec
Creator II
Creator II
Author

hi sunny,

len is not working as many of the data is null or -

jayaseelan
Creator III
Creator III

Hi,

Try This..

if(GetSelectedCount([closing date])=1,[Closing Date],

if(GetSelectedCount([Opening Date])=1,[Opening Date], [Last Date]))

antoniotiman
Master III
Master III

If(Len(Trim([Closing date]))=0,If(Len(Trim([opening date])) > 0,[Opening date],[Last date]),[Closing date])

Peter_Cammaert
Partner - Champion III
Partner - Champion III

That's exactly why Sunny is suggesting to use the len(trim()) combo. It handlles empty fields, whitespace strings, Null values all in the same way. This is a best practice if you cannot expect the data source to return a single "no value present" indicator.

raadwiptec
Creator II
Creator II
Author

hi jayasselan ,

this is giving results but it only takes Last Date values......it is not considering even if opening dates are there

Not applicable

can you provide screenshot of the data?

raadwiptec
Creator II
Creator II
Author

hi peter,

If lenght is used .. i dont get any values.. not sure why.. but for example if i put

if (closing date) = '' or '-' ,date(opening date),-- it correctly takes from other column.. but if i put one if condition it does not work

Peter_Cammaert
Partner - Champion III
Partner - Champion III

So this means that the hyphen is actually present in your date fields? And not just the representation of a Null value in a QlikView object? You may want to change the zeroes in Sunny's expression into 1s.

If this still doesn't work, then we are lacking context details. Please upload an example document that exhibits this behavior. Thanks.

Peter