10-15-2019, 12:32 PM
|
#1
|
Newly Registered User
Join Date: Jan 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
Davg in report group footer
I am trying to get an average as follows:
=Davg("dayspastdue","div30qry","dayspastdue >=0")
This works in giving me the overall average (of overdue tickets) for the entire report. I need to get the same average per group [salesperson] and it doesn't seem to adjust for the group. I'm sure I need to add another criteria, but don't know how. . .
Any help would be greatly appreciated!
|
|
|
10-15-2019, 12:42 PM
|
#2
|
Newly Registered User
Join Date: Apr 2015
Location: KY,USA
Posts: 3,378
Thanks: 0
Thanked 747 Times in 732 Posts
|
Re: Davg in report group footer
in the report, add a GROUP band (for what ever group you need)
set it WITH FOOTER
in the footer , put your AVG( field).
(you don't need DAVG, but you can)
|
|
|
10-15-2019, 12:42 PM
|
#3
|
I’m here to help
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,461 Times in 1,442 Posts
|
Re: Davg in report group footer
Hi Victoria. Are you saying a simple Avg() function in the group footer doesn't work?
__________________
Just my 2 cents...
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
10-15-2019, 12:50 PM
|
#4
|
Newly Registered User
Join Date: Jan 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
Re: Davg in report group footer
I have the group set with header/footer. It is grouped on [salesperson]. I need to average only tickets that are overdue, i.e., those that show as 0 or greater days. I tried to use Avg(IIf([dayspastdue]>=0,1,0)) but it keeps returning "1" for every salesperson. [dayspastdue] is a calculated field in the underlying query (based on two dates).
|
|
|
10-15-2019, 06:53 PM
|
#5
|
I’m here to help
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,461 Times in 1,442 Posts
|
Re: Davg in report group footer
Quote:
Originally Posted by VictoriaHood
I have the group set with header/footer. It is grouped on [salesperson]. I need to average only tickets that are overdue, i.e., those that show as 0 or greater days. I tried to use Avg(IIf([dayspastdue]>=0,1,0)) but it keeps returning "1" for every salesperson. [dayspastdue] is a calculated field in the underlying query (based on two dates).
|
Hi Victoria. Are you able to post a copy of your db with enough test data to duplicate the problem?
__________________
Just my 2 cents...
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
10-15-2019, 10:52 PM
|
#6
|
High Noon Moderator
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,382
Thanks: 115
Thanked 3,113 Times in 2,831 Posts
|
Re: Davg in report group footer
Just to clarify, if you used an expression like Date()-[DueDate] AS DaysPastDue in your query, you can't reliably use DaysPastDue in another field in the same query such as your IIf expression.
You must use the full expression again for the derived field e.g.
Code:
SELECT DueDate, Date()-[DueDate] AS DaysPastDue, Iif((Date()-[DueDate])>0,1,0) AS Overdue
FROM TableName;
Alternatively you can use IIf(DaysPastDue>0,1,0) in a second query based on the first
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.
Colin (Mendip Data Systems) To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Website links: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Common sense and a sense of humour are the same thing, moving at different speeds. (Clive James - RIP)
|
|
|
10-16-2019, 09:20 AM
|
#7
|
Super Moderator
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 28,316
Thanks: 15
Thanked 1,601 Times in 1,520 Posts
|
Re: Davg in report group footer
When calculating overdue, return null rather than 0 when the item is not overdue. The domain functions will ignore nulls but will include zero so:
Avg(3,0,3) = 2
BUT
Avg(3, null, 3) = 3
Then the control for the average would have a simple expression as its ControlSource:
=Avg(OverDueDays)
__________________
Bridge Players Still Know All the Tricks
|
|
|
Thread Tools |
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
All times are GMT -8. The time now is 03:38 PM.
|
|