Jump to content
We've recently updated our Privacy Statement, available here ×

Cross Tab Query


sthakur11

Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Here are the steps that you would follow to create a simple crosstab report.

1. The query below will show you the Name of the Sales person, the name of the items they have sold and the quantity of items they have sold. Place this query in the main report query section.

select 'John Doe' as 'SalesPerson', 'Tennis Balls' as 'ItemsSold', 2 as 'Quantity'
union all
select 'Jane Doe', 'Baseball Gloves', 3
union all
select 'Jane Doe', 'Pool Table', 5
union all
select 'John Doe', 'Pool Table', 2

2. Go to create new Crosstab and place this in your "Summary" band
3. Select the available dataset. In this example it will be the main report query then click next
4. Select the "SalePerson" field for Row group 1 then click next
5. Select the "ItemsSold" field for Column group 1 then click next
6. Select the "Quantity" field for Detail field and select "Sum" for Function and then click next. **Note** If you are already doing the  calculation in your query then you can set the Function to "Nothing".
7. Depending on your requirement, select the appropriate group totals. For this example we will have both row and column totals then click next or finish
8. Now run the report
9. For formatting changes either go to the "crosstab-1" tab on the top or simply right click on click on "Go to crosstab design tab..."
10. This is all you need to do to create a simple cross tab.

For your convenience, I am also attaching the jrxml of the crosstab that I created using the above mentioned steps.

Hope this helps!

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...