Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
DaithiOK
Contributor II
Contributor II

How to create a flag for null Date values

I want to create a flag to denote a project that has never had an update. In my dataset one project can appear multiple times if it's had multiple updates and [Last Update Date] will give the date of that update. I am using my [Last Update Date] in a different flag but realize i am missing out on all those projects that don't get counted because they don't have a [Last Update Date].

How can I flag the projects where the [Last Update Date] is null because it has never been updated.

 

In the load script right after [Last Update Date] I tried the line

if(isnull([Last Update Date]),1,0)

but that only flags when the column [Last Update Date] is null rather than when that column is null for a particular project. 

 

Right now I'm trying 

Null_Flag_Test:
Load
      [Project Code], 
      date(MONTHSTART(max([Last Update Date])),'DD/MM/YYYY')  as MaxUpdateDate,
      if(len(date(MONTHSTART(max([Last Update Date])),'YYYY-MMM')),0,1)
From
[..DataSource.qvd]
(qvd)
group by [Project Code];

but it doesnt seem to work either. I figure that given there are multiple update dates that this table would give me the project code and its most recent [Last Update Date] and if the column was null then there would be no Max so it would get flagged in the third column. It doesnt seem to work though. Can anyone offer suggestions?

Labels (1)
  • Null

1 Solution

Accepted Solutions
Saravanan_Desingh

To capture the NULL, you can try all these options.

If(isNull([Last Update Date]) Or [Last Update Date]='' Or Len(Trim([Last Update Date]))=0
,1,0)

View solution in original post

2 Replies
vamsee
Specialist
Specialist

Hello,

Firstly, in both the if statements you are missing the condition.

Try

if(isnull([Last Update Date])=-1,1,0)

  Or I would suggest

if(len(Max([Last Update Date]))<>0,0,1) as Missing_Update

All 1's would give you projects with no update date.

Saravanan_Desingh

To capture the NULL, you can try all these options.

If(isNull([Last Update Date]) Or [Last Update Date]='' Or Len(Trim([Last Update Date]))=0
,1,0)