# Counting Multiple Columns in Reports

1. Novice
Windows 10 Access 2016
Join Date
Dec 2021
Posts
4

## Counting Multiple Columns in Reports

Good day everyone.

Trying to calculate the sums of three columns in a report. In the report, i used the Total "x" function for each of my columns, but when I try to use =Count([X1]+[X2]+[X3]) it just returns a zero. I even tried changing field to =Count([AccessTotalsX1]+......... . Any help would be appreciated. Thank you and happy holidays!

2. Well, I tried at least.
Windows 10 Access 2016
Join Date
Jul 2017
Posts
980
You want to COUNT the columns? (We should probably refer to columns as fields) Do you mean add them up? You want something like sum_of_x1 + sum_of_x2 + sum_of_x3 ? That would just be =SUM([field1]+[field2]+[field3])

3. Novice
Windows 10 Access 2016
Join Date
Dec 2021
Posts
4
I have tried that one as well. It returns a zero as well.

4. Well, I tried at least.
Windows 10 Access 2016
Join Date
Jul 2017
Posts
980
Originally Posted by CPWachs
I have tried that one as well. It returns a zero as well.
Maybe try this:
Code:
`=Sum(Nz([Field1])+Nz([Field2])+Nz([Field3]))`
I'm guessing here. You're going to have to help us help you. "doesn't work" isn't much for us to go on. If the above doesn't work attach a zipped copy of your db as well as an explicit description of exactly what it is you're trying to achieve.

5. What exactly is "Total 'x' function"? What do you mean by title "Count Multiple Columns"? What exactly do you expect =Count([X1]+[X2]+[X3]) to return?

Show some sample data and desired output or provide db for analysis.

Cannot reference control names in aggregate functions, must be fields.

6. Novice
Windows 10 Access 2016
Join Date
Dec 2021
Posts
4

Apologies for the late replies and thank you for the quick responses. Attached is picture of what I'm working with. Trying to make an Attendance Report. I can get the total of each individual column such as DX, NX, MX, etc, but I can't get it to add the three together to make 26. In the picture, I used =Count([AccessTotalsDX]+[AccessTotalsNX]+[AcessTotalsMX]) which does return 26, but when I open the Report it asks for the parameter value. If I enter 1, it returns 26. Hopefully this helps and thank you again.

7. VIP
Windows 10 Office 365
Join Date
Sep 2017
Location
UK - Wiltshire
Posts
2,217
I think you simply need

= [AccessTotalsDX]+[AccessTotalsNX]+[AcessTotalsMX]

Assuming those are already Sum() style controls in the form or report footer.

If not you may need to repeat the calculation individually

= Sum(DX) + Sum(NX) + Sum(MX)

8. Novice
Windows 10 Access 2016
Join Date
Dec 2021
Posts
4
@Minty.
=([AccessTotalsDX]+[AccessTotalsNX]+[AcessTotalsMX]) did the trick! Thank you so much!