How to add SSRS page break after 65536 rows, counting group header/footer - sql-server-2008

I have an SSRS report which is failing to export to excel when the row count is greater than the Excel 2003 limit of 65536
The report already has a grouping level with a group footer.
I have tried to add an extra grouping level with a page break on the expression
=ceiling(rownumber(nothing)/65536)
However, this counts the detail rows, but does not take into account the group footer. So the rownumber evaluates to 53000 while the actual number of rows has exceeded 65536.
The following expression
=ceiling(RunningValue(Fields!myfirstgroup.Value, CountDistinct, Nothing) + rownumber(nothing) / 65536 )
will give me the actual row count including the group footers, but SSRS will not allow a group on a running value expression.
How can I force a page break after 65536 rows to allow an export to Excel? I had hoped to accomplish this in the report definition, and avoid adding a calculated page number in the query .
Any help much appreciated
* UPDATE - Sample data *
ItemDescription , Location , Quantity
Red lorry , M25 , 5
Red lorry , M6 , 2
Yellow lorry , M1 , 3
Report has a grouping on ItemDescription with a total for that item, so it will show
ItemDescription , Location , Quantity
Red lorry , M25 , 5
Red lorry , M6 , 2
Total for Red Lorry,7
Yellow lorry , M1 , 3
Total for Yellow Lorry,3
This means from my 3 rows of data, I have 5 report rows including detail and footer rows. SSRS can tell how many details rows are in my dataset, but I need to take the footers into account for a page break.

Hi this link might help you. I had similar sort of issue, a few years back.
SSRS Page break on Tablix with Rownumber ,just one row group and no group expression given by default
=Floor((RowNumber(Nothing)-1)/2000)
was the suggested answer

Create a group with the following expression:
=CInt(Ceiling(RowNumber(nothing)/65000))
The 65000 give you a little extra room for any headers or footers. Next, do a Page Break on this group "Between each instance of a group" and "Also at the end of a group" and you will successfully beat the excel file limit issue.
This is what we normally use without any issue. I don't think any one will notice if you don't specifically use all 65,536 rows.

Related

SSRS Report - Badges

Is there an easy way to do a page of badges in an SSRS report? I am looking at 2 across and 3 down per page based on a list. I have built one so far of a single column using a list box but the problem is that it is not advancing to the next record and shows me the same record over and over until I get to the end of the count of total records in the dataset so I know I am doing something wrong. I am using Visual Studio 2017
I use a matrix when I am making a grid with boxes that go across and down.
First I add a ROW_NUMBER to the query to have the order in which to show the records. I subtract 1 so the values start with 0.
SELECT *, ROW_NUMBER()OVER(ORDER BY EFF_DATE) - 1 ROW_NUM
FROM BLAH_BLAH...
Then in SSRS, add 2 Calculated Fields to the dataset with the ROW_NUM.
The first is named ROW. It will have an integer with the row that the record will end up in.
=INT(Fields!ROW_NUM.Value / 2)
The second is COLUMN that will give the a column number.
=Fields!ROW_NUM.Value MOD 2
Then in the matrix, set the grouping based on the calculated fields.
COLUMN GROUP
Group and Sort by COLUMN
ROW GROUP
Group and Sort by ROW
The 2 can be changed to use whatever number of columns is needed.

Filter SSRS Tablix into 2 columns that updates dynamically for menu page links

I have this SSRS report which I'm using as a menu page, with an action assigned to each report name to take the user to it. But as you can see with more and more reports being added, it's slipping over the page.
I want to create a menu page which has the report names in two columns and don't know how to go about this.
In design view I have one tablix which currently looks like this
With this code in the dataset:
SELECT [ReportOrder],[ReportID],[ReportPath],[Folder],[ReportName],[ItemType]FROM [dbo].[DimSSRSReportList] WHERE Folder = 'Customer Services' AND ItemType = 'Report'
My initial thought was to have two Tablix side by side and filter the left to top 50% and right to bottom 50% but this is just repeating the same reports on either side
Can anyone help?
Thank you muchly
--------EDIT!--------
I can't quite get the column grouping using the MOD function to work. I've added the expression to the top and it's returning everything as 1. This is how it currently looks
This is an extension to Hannover's answer but it should make things easier as there are no calculations in the report design.
Change the dataset query to the following...
SELECT ReportOrder, ReportID, ReportPath, Folder, ReportName, ItemType
, CAST(((ROW_NUMBER() OVER(ORDER BY ReportOrder)-1) / 2) as INT) as RowN
, ((ROW_NUMBER() OVER(ORDER BY ReportOrder)-1) % 2) as ColN
FROM [dbo].[DimSSRSReportList]
WHERE Folder = 'Customer Services' AND ItemType = 'Report'
If you run this query in SSMS you'll see you get data similar to this simplified exmaple
ReportOrder, ReportName, RowN, ColN
1 FirstReport 0 0
2 SecondReport 0 1
3 ThirdReport 1 0
4 FourthReport 1 1
5 FifthReport 2 0
Next Add a matrix, and set row group to group on RowN and the column group to group on ColN
That should be it.
This is easier if you can add a Row Number to your data.
SELECT ReportOrder, ReportID, ReportPath, Folder, ReportName, ItemType,
ROW_NUMBER()OVER(PARTITION BY ReportID ORDER BY ReportOrder) AS ROW_NUM
FROM [dbo].[DimSSRSReportList]
WHERE Folder = 'Customer Services' AND ItemType = 'Report'
Then use a Tablix to show your data, with Column Grouping of
=Fields!ROW_NUM.Value MOD 2
and Row Grouping of
=INT((Fields!ROW_NUM.Value - 1) / 2)
The MOD function will return 1 or 2 for the column that the report name will appear while the Row Group will divide the data into groups of 2.

how to calculate sum of row in crystal report using sql query, and do not display if the sum equals to 0.00

I have the following crystal report, I want to calculate the sum of each row of specific columns:
Opening Quantity
Purchase Quantity
Issue Quantity
if sum of the above 3 columns is equal to 0.00, then do not print that record.
Please look out at the screenshot of generated report:
I am to guess here that the fields are placed in the DETAIL section , if then you can use the suppress formula(Section Expert-->Detail Section-->Suppress formula)
and try something like this
{Opening Quantity field} + {Purchase Quantity field} + {Issue Quantity field} = 0
I think this can give some idea to you
1) you have to create a formula to sum up the opening quantity, purchase quantity and Issue quantity by using Running Total Field.
Let say your field name for opening quantity inside the TableA is 'opening quantity'.
Thus, choose Table A, inside the Running Total Field and find the 'opening quantity'.
Then, choose 'SUM' as Type of Summary.
Do the same for another two fields.
At last, you will have 3 different running total field formula.
2) combine together these 3 formula inside one new formula.
Your final formula should look like this.
Let say you name it as Formula 4
if {#Formula1}+{#Formula2}+{#Formula3}<>0 then {#formula1}+{#formula2}+{#formula3}
then you drag this formula to any space in the report that you want the total to appear.
3) After drag it, right click on the formula and press 'Format Object'
Check the suppress box and write this inside the blue cross tab beside the suppress checkbox
{#Formula4}=0

SSRS - how to create a double entry table

I need to create a report which is something similar to a Pivot Table.
The report would be something like below, with more towns
I C S Total
Town1 1 2 3 6
Town2 7 1 1 9
Town3 2 3 1 6
Total 10 6 5 21
In Crystal reports, there is an integrated function called Cross table
(see pictures below)
I'm looking for a similar function in SSRS, if there is any. I parsed the internet but I could not find anything that is relevant
Thanks!
You need a matrix to do so
Select the row, once the matrix created, like the image below and click on the row group and look at the group properties
You then choose the row for which you want to do the grouping like the image below
Repeat the operations for the column group.
You will need to add additional row and columns for the total.
I will do that for the row. You click the row to highlight it and then click on insert rows. You then choose Outside group below like in the picture below
Repeat the operations for the column group.
To have total, please put the following formula in your row and column created outside of the group SUM(COUNT(Fields!name_of_your_field.Value)) and you have the double entry table.
Let me know through the comments if you have any issues, I'll happy to help.

Grand totals in Telerik Reporting

I'm trying to put together what I had thought would be a fairly simple report using Telerik Reporting, and I'm having a problem.
The data source is a DataTable containing outergroupid, innergroupid, number1, and number2, sorted by outergroupid, innergroupid.
I want a report laid out like this:
Outer Group 1
Inner Group 1.1 12 14
Inner Group 1.2 11 17
Outer Group 1 Totals: 23 31
Outer Group 2
Inner Group 2.1 22 24
Inner Group 2.2 21 37
Outer Group 2 Totals: 43 61
Totals: 66 92
And all of this is pretty easy, except the final grand total.
I created a group on outergroupid, and added a header with the id, and a footer with id, "Totals:", and Sum() on the numeric fields, and that handled the subtotals fine.
My problem: if I add a grand totals line in the report footer, I get a page break between the detail and the report footer - which I can't have. I've fiddled with KeepTogether, and it doesn't seem to have made a difference.
My next try was to create a global group within the detail. I'd figured that if I introduced a group with no grouping expression, it's GroupFooter would process after everything. It didn't.
So, what I need is either a way to keep the report footer from breaking onto another page, or a way to create a group that groups on everything.
Any ideas?
Solution 1 (on a 'traditional' report): add a fake group on top the real group. With a condition e.g. like "1=1".
Note: do not use the footer for this.
Solution 2: use a table item (a.k.a crosstab). On a table item, you can easily have totals and grandtotals.
The table item (with its details, totals and grandtotals) will be on the same report's section. E.g. on the report's Detail section.
You must create a report to have 2 grouping ,first you already have , A second is group that upper level than your current group,and then that group you must set data for grouping(fake data column from Databse ) at whole report , at last on report set show group footer then set content you want to.
For easy designing you can use a table object or it applies to normal report too.
Add a row group on the detail section and then add a parent row group of the 1st group by allowing the wizard (if comes any) to add their header and footer rows.
Now after all rows (in detail section) add a new row (for grand total). Any aggregated value added in this new row shall a grand total and will be shown on the same page.