Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
qw_jakub
Partner - Contributor III
Partner - Contributor III

IntervalDate and EvenDate Meassures

Hello,

in my data I have several tables where I need to calculate meassures for both Interval between two dates and dates as events.

For example I need to calculate how many new customers registered on a given date, and how many registered customers I had on that date.

In the sample data, I have a Master Calendar and make an IntervalMatch between the Registration_Start and Registration_End Fields.

Then I use the expression:

= count(ID)

for counting registered customers (interval).

And the set expression:

= if(isnull(getfieldselections(Date)),Count(ID), Count({$<[Registration_Start] = Date>} ID))

for counting new registration (event).

Now this works fine, If i filter by a single (master)date. But if I filter by (master)month the expression for events fails.

For example if I select all dates from  5.2013 I get the right count of registrations = 7.

But if I select just month = 5, and year = 2013, the set expression won't get linked to the date and I get a wrong count of registrations = 12.

Do i need to write set expression for all master calendar fields or is there a simpler way to get to the right numberr?

Thanks for any tips!

Jakub

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached qvw


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

See attached qvw


talk is cheap, supply exceeds demand
qw_jakub
Partner - Contributor III
Partner - Contributor III
Author

Thanks a lot!

The code:

=if(GetPossibleCount(Date),Count(distinct if(Registration_Start=Date,ID)),count(ID))

seems to do the job well.

Just out of my couriosity, in which case would the "then" part of the first if (count(ID)) come into action?

It seemes to work without it, as much as I tested it.

J.