Aggregate Function error when running query

DrandonC

New Member
Joined
Jun 7, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hello. I have the following formula in my query:

Rx Payments: IIf([tbl_RevCode_Classifications].[Total Charges]=0,0,Sum(([tbl_RevCode_Classifications].[Rx Charges]/[tbl_RevCode_Classifications].[Total Charges])*[tbl_RevCode_Classifications].[CashReceipts]))
On the Total Line I have "Expression"

When I run the query I get "your query does not include the specified expression as part of an aggregate function" on that above formula.

Google sites argue that I need "Group by". I tried that rather than Expression to no avail.

I've been at this all day and don't know what else to do. HELP.

Thank you.
 

Attachments

  • Access error.jpg
    Access error.jpg
    61.8 KB · Views: 36

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Welcome to the Board!

I think you may have structured it wrong. You typically see "SUM" on The "Totals" row of the query, not in the formula itself in Aggregate Queries.
Can you post a small sample of your data, along with an explanation of your expected results?
 
Upvote 0
The Google notion that you need Group By likely doesn't apply to your calculated field - it may be that one or more fields used in that expression is also part of the SELECTed fields but it/they are not part of a Group By. Just a guess without seeing the entire sql. Even then it's not likely I'd know for sure as I usually have trouble getting what I want from a Totals query.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top