Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Qlik Users, make your voice heard! Participate in Wisdom of Crowds® Market Study: Start Survey
cancel
Showing results for 
Search instead for 
Did you mean: 
Meg00
Contributor III
Contributor III

Small issue with IntervalMatch

Hello everyone! I have a small but very annoying issue with IntervalMatch.

My data consists of "membership" start and end date, so I've done an IntervalMatch to be able to count number of flags for "active members" for a given day, month or year etc.

My issue is, when I count the flag it seems as tho all of the "membership" without an end date (currently active) doesn't have a flag at all.

 

Members:
LOAD
ID,
Start,
End,

FROM blahblah

tempTable:
LOAD min(Start) as mindate,
max(End) as maxdate
RESIDENT Members
;

LET vMinDate = fieldvalue('mindate',1)-1; 
LET vMaxDate = fieldvalue('maxdate', 1);
DROP TABLE tempTable;

DateTable:
LOAD *,
ActiveDate as Date,
Week(ActiveDate) as Week,
Year(ActiveDate) as Year,
Month(ActiveDate) as Month,
Day(ActiveDate) as Day

;
LOAD date($(vMinDate) + IterNo()) as ActiveDate
AUTOGENERATE 1
WHILE $(vMinDate) + IterNo() <= $(vMaxDate)
;


LEFT JOIN(Members)
IntervalMatch (ActiveDate)
LOAD
Start,
End
RESIDENT Members;

LEFT JOIN(Members) LOAD 1 as ActiveCounter AUTOGENERATE 1;

 

 

Have I missed anything?

 

/Meg

Labels (1)
2 Replies
miskinmaz
Creator III
Creator III

You need to mention if there is no end date then consider today as end date and mark membership as active:

LOAD
ID,
Start,
if(isnull(End), today(),End) as End

FROM blahblah
Meg00
Contributor III
Contributor III

That will work, but it's not pretty to put the end date there if there is none. That also wont work if for example I'd like to count ending in current month. So I'd rather not change the actual dates.