Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
mikeg_33
Not applicable

Finding average days between two dates

Greetings Community,

I have a set analysis to find the average days that students are on the waitlist for a course.

Course being my Dimension, and "Average Days on Waitlist" being my Measure.

My code for the Measure looks like this:

avg({$<transcript_status_code = {'W','w'}>}(date(today() - waitlist_date)))

I am having trouble building the code to show only the course(s) that have less then or equal 100 days.

Thoughts?

1 Solution

Accepted Solutions
sunny_talwar
Not applicable

Re: Finding average days between two dates

May be this:

Date(Avg({$<transcript_status_code = {'W','w'}, Course = {"=Today() - waitlist_date <= 100"}>}(Today() - waitlist_date)))

or

If(Today() - waitlist_date <= 100, Date(Avg({$<transcript_status_code = {'W','w'}>} (Today() - waitlist_date))))

5 Replies
nav_pienaar
Not applicable

Re: Finding average days between two dates

Hi Mike

Will this work ...?

=if(Avg({$<transcript_status_code = {'W','w'}>}(date(today() - waitlist_date)))>100,0,

Avg({$<transcript_status_code = {'W','w'}>}(date(today() - waitlist_date)))

Nav Pienaar

aarkay29
Not applicable

Re: Finding average days between two dates

May be this

avg({$<transcript_status_code = {'W','w'},Course={"=(date(today(),'MM/DD/YYYY')-waitlist_date)<=100"}>}(date(today() - waitlist_date)))

sunny_talwar
Not applicable

Re: Finding average days between two dates

May be this:

Date(Avg({$<transcript_status_code = {'W','w'}, Course = {"=Today() - waitlist_date <= 100"}>}(Today() - waitlist_date)))

or

If(Today() - waitlist_date <= 100, Date(Avg({$<transcript_status_code = {'W','w'}>} (Today() - waitlist_date))))

mikeg_33
Not applicable

Re: Finding average days between two dates

Thank you!

I had to use the If statement to get it to work with a little finesse.

I appreciate your help all!

mikeg_33
Not applicable

Re: Finding average days between two dates

yes,

That is actually the exact code I implemented.

if(avg({$<transcript_status_code = {'W','w'}>}(date(today() - waitlist_date))) <= 100, avg({$<transcript_status_code = {'W','w'}>}(date(today() - waitlist_date))), null())