MCaliebe
asked on
Creating a cross tab query for a report with multiple values for a column
Hi Everyone,
I am trying to wrap my head around a reporting problem. I suspect my data may not be corectly organized, but I could use your help.
I have a payroll database that houses the usual suspects...employee name, emp number, date worked, type of hours worked, hours, bonus, cash value, ect.
I will simplify my table for conversation here. My table consists of employee #, pay type, hours, dollars. Every data entry has Emp #, pay type (regular, OT, comission, bonus), hours (corresponding to regular or OT pay types), or Dollars (corresponding to commission or bonus). I couldn't combine hours and dollars together as they are different field types.
How can I develop a cross tab query and report to detail out
Row Headings: Employee number
Column Headings: Pay Types
Values: Hours under the corresponding type, and Dollars under the corresponding type.
Cross tab queries will only allow one value set. Can anyone give me an idea how to construct this report? I attached a file with a mock up of the data and how I'd like to structure the report.
Thanks!
MC
mock.xlsx
I am trying to wrap my head around a reporting problem. I suspect my data may not be corectly organized, but I could use your help.
I have a payroll database that houses the usual suspects...employee name, emp number, date worked, type of hours worked, hours, bonus, cash value, ect.
I will simplify my table for conversation here. My table consists of employee #, pay type, hours, dollars. Every data entry has Emp #, pay type (regular, OT, comission, bonus), hours (corresponding to regular or OT pay types), or Dollars (corresponding to commission or bonus). I couldn't combine hours and dollars together as they are different field types.
How can I develop a cross tab query and report to detail out
Row Headings: Employee number
Column Headings: Pay Types
Values: Hours under the corresponding type, and Dollars under the corresponding type.
Cross tab queries will only allow one value set. Can anyone give me an idea how to construct this report? I attached a file with a mock up of the data and how I'd like to structure the report.
Thanks!
MC
mock.xlsx
ASKER
Thanks for your query suggestion.
I should clarify that my Pay Tpes can grow or shrink depending on what selection is used that week. For instance, Commission may not be paid every week, however we might have some sick time and vacation time to record. Cross tab is the only way I know to use a query result for column names. Unless there is a way to make a dynamic report that will populate the headers based on what is found a the time of query execution.
Thanks,
MC
I should clarify that my Pay Tpes can grow or shrink depending on what selection is used that week. For instance, Commission may not be paid every week, however we might have some sick time and vacation time to record. Cross tab is the only way I know to use a query result for column names. Unless there is a way to make a dynamic report that will populate the headers based on what is found a the time of query execution.
Thanks,
MC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT yrTable.[Emp ID], Sum(IIf([Pay Type]="Regular",[Hours],0)
FROM yrTable
GROUP BY yrTable.[Emp ID];
change table/field name accordingly