Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average of a field on weekdays

Hi,

I have a calendar module which gives me month, weekdays, etc etc..

I have another table which connects to the calendar module by date.

Now in the table, I have a field called [enrollment count], which has some data filled for every day.

I have a chart which gives me a sum of the [enrollment count] day wise: i.e. Monday, Tuesday, Wednesday, etc.. I used the expression sum([expression count])

Now instead of sum, I want an average of the [enrollment count] day wise. So if there are five sundays in a month it should take the sum of all the five values and then divide it by 5. I used the expression avg([expression count]), but the result is not correct.

Please suggest where I am going wrong.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Me again,

I think you should change above in

=sum([expression count]) / count (distinct Date)

thus summing the values per Weekday / Month / Year, but then dividing by the number of distinct dates.

View solution in original post

25 Replies
swuehl
MVP
MVP

Maybe like

=avg(aggr(sum([expression count]),Weekday,Month))

In a table with dimensions Weekday and Month.

Hope this helps,

Stefan

Not applicable
Author

Hi Stefan,

The above expression gives me the sum of [enrollment count] on weekdays. It is not giving an average.

Any other suggestion?

Regards,

Rajiv

swuehl
MVP
MVP

Ah yes, I think my expression is more useful for totals.

Have you tried a plain

=sum([expression count]) / count ([expression count])

?

In a table with dimensions Year, Month, Weekday, I think this should give you the average count per weekday in a given month.

swuehl
MVP
MVP

Me again,

I think you should change above in

=sum([expression count]) / count (distinct Date)

thus summing the values per Weekday / Month / Year, but then dividing by the number of distinct dates.

Not applicable
Author

Hi Stefan,

Thanks for the response, but want to understand the working..

I want to understand the difference between the three expressions:

1) avg([expression count])

2) sum([expression count]) / count ([expression count])

3) sum([expression count]) / count (distinct Date)

The 1st and the 2nd expression give the same result.

Cheers,

Rajiv

Not applicable
Author

Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am

23.09.2011.

Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.

Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.

Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!

Not applicable
Author

Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am

23.09.2011.

Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.

Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.

Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!

Not applicable
Author

Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am

23.09.2011.

Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.

Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.

Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!

Not applicable
Author

Ich werde ab 05.09.2011 nicht im Büro sein. Ich kehre zurück am

23.09.2011.

Ich werde Ihre Nachrichten nach meiner Rückkehr beantworten.

Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Verwertung des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt.

Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank!