SSRS Column Group Layout - reporting-services

I have a report that lists items and then the number of units and subtotal for each day. I have the report set up with a column group so that it has day as a column header and then the units and subtotal listed below (example 1 below). The user is wondering if I can rearrange the columns to show all units together and then all subtotals together (example 2 below). I have not been able to figure out a grouping option that would allow this. Is it possible?
Example 1:
Mon
Tues
Wed
Item
Units
Subtotal
Units
Subtotal
Units
Subtotal
A
1
2176
0
0
3
1461
B
4
1941
2
481
1
857
Example 2:
Mon
Tues
Wed
Mon
Tues
Wed
Item
Units
Units
Units
Subtotal
Subtotal
Subtotal
A
1
0
0
2176
0
1461
B
4
2
1
1941
481
857

Create a second column group and use the same grouping as the first. Move the Subtotal to the second grouping.
Add a row above the top one outside the group for the Unit and Subtotal headers so they span all of the days.

Related

report server: add to line plot one more line with summa

Would you prompt me, please how to create the additional line on the line chart, which contains sum over all the lines in the chart.
E.g.:
-we have sales over months:
-x-axis is months
-y-axis is sum of sales
On the line chart, we have 3 lines:
-sales on office1
-sales on office2
-sales on office3
On the same chart, I need to add a line with summa of sales over 3 offices.
Thank you.
It depends on what your dataset looks like but the easiest way is usually to do this in your dataset query and supply the 'Total' office numbers in the same manner as the current numbers.
So, if your data looked like this
Office
Month
Amount
Office1
01
1000
Office2
01
1100
Office3
01
1200
Office1
02
1300
Office2
02
1400
Office3
02
1600
Office1
03
1700
Office2
03
1800
Then you could do something simple like
SELECT Office, Month , Amount FROM myTable
UNION ALL
SELECT 'Total', Month, SUM(Amount) from myTable GROUP BY Month
This way "Total" just gets displayed like any other office.

SSRS CountRows shows duplicated number

The dataset looks like
Time Type
2018 a
2019 b
2013 c
2017 a
2018 a
I want to get number of rows according to Type.
So I have add Type under Row Groups called GroupByType
In the expression, I have used
=CountRows()
but it end of with number of 1s according to Type,
a 1
1
1
b 1
c 1
But when I use
=CountRows("GroupByType")
it shows:
a 3
3
3
b 1
c 1
How can I get the following structure?
a 3
b 1
c 1
In Row Groups section you need to remove the details section: =(Type)

SSRS 2 column groups in matrix, 1 row reads from 1, the rest read from the other? (pls help)

Is there a way in SSRS to have an additional row within your row group, to look at a different column group than the rest of the row group
Let's say I have STATES, SALES, MONTH, and BUCKET_MONTH as my dataset fields BUCKET_MONTH is already calculated for me, based off of the MONTH. I want to show something like this:
SAMPLE DATA LIKE THIS FOR FLORIDA (and other months but BUCKET_MONTH only matters for florida let's pretend)
STATE MONTH SALES BUCKET_MONTH
FL JAN 50 FEB
FL FEB 125 FEB
FL MAR 100 MAY
FL APR 0 MAY
FL MAY 100 MAY
SSRS MATRIX MIGHT LOOK LIKE THIS: ?
| 2 groups ?
| MONTH
| BUCKET_MONTH (I can hide this header)
-----------------------------------
1 col group|
STATE | SALES
BUCKET | SALES <-- this row is only visibile for FL which I know how to do
EXPECTED RESULTS WOULD LOOK LIKE THIS
JAN FEB MAR APR MAY JUN JUL
---------------------------------------------------------------------
CA 100 300 150
FL 50 125 100 0 100
FL BUCKET 175 200 <-- BUCKET_MONTH**
MA 0 200 250 50
BUCKET_MONTH in ds shows FEB for the rows with Jan,Feb MONTH, and shows MAY for Mar,Apr, May MONTH
Is there a way to do this in SSRS? Where one of the rows looks at a different column group to establish what column to put the SUM of SALES in?
Much appreciation in advance!
You have to add BUCKET_MONTH as parent column group in your matrix.
Add BUCKET_MONTH in the Column Groups pane, then delete the created row in the matrix selecting Delete groups only option. Now add MONTH as child group in column groups pane.
Add STATE in rows group pane and add a row for bucket total.
Use this expression for BUCKET TOTAL:
=IIF(
Fields!BUCKET_MONTH.Value=Fields!MONTH.Value,
SUM(Fields!SALES.Value,"BUCKET_MONTH"),
Nothing
)
It should produce:
UPDATE: Expression updated taking in account that MONTH and BUCKET_MONTH fields are actually dates.
=IIF(
UCASE(format(Fields!BUCKET_MONTH.Value,"MMMM yy"))=
UCASE(format(Fields!MONTH.Value,"MMMM yy")),
SUM(Fields!SALES.Value,"BUCKET_MONTH"),
Nothing
)
Let me know if this helps.

Aggregate values based on a date interval

I have a database containing monthly precipitation values at some measurements locations. The structure of my table is:
describe pp_lunare;
Field Type Null
ID int(11) NO
DATA_OBS date NO
PLUTON float NO
LEGHIN float NO
DUMBRAVA float NO
A sample of my data:
ID DATA_OBS PLUTON LEGHIN DUMBRAVA
1 1977-01-01 14.4 33.3 25.1
2 1977-02-01 18.7 12.9 13.2
3 1977-03-01 32.8 26.7 18.3
4 1977-04-01 109.6 123.8 140.6
5 1977-05-01 98.5 104.7 59.9
6 1977-06-01 192.9 172.8 66.6
7 1977-07-01 101.4 85.8 79.4
8 1977-08-01 116.4 103.3 105.7
9 1977-09-01 54.5 47.4 51.8
10 1977-10-01 23.6 15.6 11
11 1977-11-01 59.7 44.3 29.7
12 1977-12-01 28.7 13.1 10
In my case I need to get the sum of the precipitation for every column at every 3 months something like this:
ID DATA_OBS PLUTON LEGHIN DUMBRAVA
1 1977-03-01 65.9 72.9 56.6
2 1977-06-01 401 401.3 267.1
3 1977-09-01 272.3 236.5 247.9
and so on...
Thanks.
You can get the month from your date with month(data_obs) which returns a month from 1 to 12. Convert this to a value for the quarter by doing something like floor((month(data_obs) - 1)/3) as quarter to get quarters from 0 to 3.
For example, select data_obs, concat(year(data_obs), floor((month(data_obs) - 1)/3)) as quarter from pp_lunare; should show you both the original date and the derived quarter side by side.
Then group by this new value and sum the rest:
select concat(year(data_obs), floor((month(data_obs) - 1)/3)) as quarter, sum(pluton), sum(leghin), sum(dumbrava)
from pp_lunare
group by quarter
order by quarter;
If you want the exact date format you had in the question, you'll have to do a little bit of string manipulation (add 1 to the quarter above, multiply that by 3, pad with 0s, then tack on a "-01" for the date).
You can get the month data at first, and convert it into [quarter], which is from 0 to 2.
Then you can create three temporary tables given [quarter]=0,1,2,
and the easy and final part will be to add up the i_th row in these tables, the result will be just like below. And you can also have the data_obs data as well.
ID DATA_OBS PLUTON LEGHIN DUMBRAVA
1 1977-03-01 65.9 72.9 56.6
2 1977-06-01 401 401.3 267.1
3 1977-09-01 272.3 236.5 247.9

SSRS Tablix report, handling column period totals and subreport comparisons

I'm new to SSRS (2008) and am trying to replicate an existing Access report. The report lists sales totals by month, and I've not had any issue resolving the basics into a tablix. However the original Access report then totals columns by quarter, 6 month and yearly values, and moreover applies incorporates subreports to compare these with previous year totals and targets. Schematically thus
Sale Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Total
Customer 1 1 11 10 8 1 2 0 0 0 1 3 4 40
Customer 2 0 1 3 1 0 0 0 1 1 0 2 1 10
MonthlyTotals 1 12 13 9 1 2 0 1 1 1 5 5 50
Quarterly 26 12 2 11
6 Monthly 38 13
Yearly 51
Prev Yr Totals 2 10 10 5 5 0 0 0 0 0 0 10
Monthly Diff -1 2 3 4 -4 2 0 1 1 1 5 -5
Quarterly Diff 4 2 0 10
And so forth. Note that the parameters are set so that the report can start at any month to lists the columns (for different financial years)
I have everything working fine for the first 4 lines (sale, customer 1, customer 2 and monthly totals) in the above, but cannot see the best way of
Displaying the quarterly etc totals
Displaying the subreports to show the previous years and target values with the differences between them and the current values.
I have full access to the SQL Server and am comfortable with complex queries and stored procedures, so was inclined to generate the values in a table and display out that, but is there a better way? In particular handling the quarterly etc totals in SSRS would be advantageous.
I think it is not possible to caclulate the quarterly totals with the help of Tablix alone, unless your SQL Table has a separate column named "Quarter".
So to achieve your requirement, you have to write simple stored-procedure which returns the resultant table along with one more additional column named "Quarter" which contains the values from "Q1..Q4" which is calculated based on the sales month field.
Then you can add this new column (Quarter) as ColumnGroup on top of your existing group in the tablix.
Hence the whole idea is to create the result set with all possible columns for which you want to group.