I am using SSRS 2014. My end goal is to get a table that looks like the following:
Project Status # of Projects Oldest Project Avg Project Age
Status 1 27 82 16
Status 2 9 29 6
Status 3 13 112 25
Status 4 33 68 16
Status 5 1 63 63
Status 6 1 27 27
Grand Total 84 112 17
A table like this, including the grand totals, can be done in Excel using pivot tables (this is how the data was originally retrieved...manually...)
If I have the same source data in a table where my columns include projectStatus and projectAge, I could generate a query to get all but the grand totals in SQL:
SELECT projectStatus, COUNT(projectStatus), MAX(projectAge), AVG(projectAge)
FROM projects
GROUP BY projectStatus
If I wanted to add grand totals to that, I could do a UNION with the following query:
SELECT 'Grand Total', COUNT(projectStatus), MAX(projectAge), AVG(projectAge)
FROM projects
Note that the grand totals are calculated off of the entire dataset and not just the grouped data - this mostly applies to the average, because it just happens to work out for the COUNT and MAX columns.
Now, if I am trying to generate this above table in SSRS, it is easy to generate the above table sans grand totals using the former query. However, now how do I add grand totals?
I could instead try a different approach where I use a more generic dataset query like:
SELECT projectStatus AS statusCategory, projectAge AS daysInCurrentStatus FROM projects
And then use aggregate functions in my table and have SSRS do the aggregation itself and provide grand totals on the raw data. I get a new problem now. What is the correct way to set my table up? I am calling grouping by [statusCategory] as "Group1", using scoped aggregate functions like so:
And it correctly generates the grand totals, but now I have a new problem: it is showing the average for each row instead of just one cell per group/scope. Is this something SSRS is meant to do, and if so, how can I do it?
...
You need to mess around a little to get right layout, but you basically need a group header or footer to show the Group aggregates.
if you right click on the lines next to [statusCategory] and select Insert Row > Outside Group - Above it will create a group header for you. Then just add your aggregate expressions in the correct columns like =Count(Fields!projectStatus.Value) then you can just set Row Visibilty on the details row to hide if you dont want to see it.
you should end up with a layout similar to this.
with the middle row (detail) visibility set to false
You're on the right track. You have two Row Groups right now. All you need to do is remove the inner one because it's not grouped by anything. In other words, it's repeating for every row of raw data.
So the Row Group named "Details" - either remove it or in the properties click "Add" and group it by 1. That will collapse those rows and do what you were expecting.
Related
I'm new in stimulsoft.I'm trying to build a report with three tables which I know I should use master details but I can't find a way.
well, I have three tables.
1.Info(Date,name,type,x,y)
2.cost(Date,Item,amount)
3.Bill(Date,BillNo,PaymentNo,Cost)
column Date is the key.
I want to group the information of these tables by date
and under each group I want to show the information of each table in Separate databands.in this way:
5 Sep 2016
name1,type1,x1,y1
name2,type2,x2,y2
Item1,amount1
Item2,amount2
Item3,amount3
BillNo1,PaymentNo1,Cost1
4 Sep 2016
name3,type3,x3,y3
Item4,amount4
Item5,amount5
BillNo2,PaymentNo2,Cost2
BillNo3,PaymentNo3,Cost3
there are multiple rows with equal date in tables.
I try many ways but it shows all cost and bill information per rows of info!!
Is there any way? Thanks.
Use Group Header (or Group Footer) within a DataBand.
Remember set the condition for your Group Header to your column Date like this:
{YourDataSource.Date}
By this, the Date field apear only once in the group.
I have a following employee table value as below :
name | cost
john | 1000
john | -1000
john | 5000
when we add the cost column total will be 5000.
I need to print only the 3rd row in BIRT report, since the 1st and 2nd row get cancelled out each other.
I'm stuck at filtering the table for above scenario.
Couldn't you just solve this using SQL like
select name, sum(cost)
from employee
group by name
order by name
?
Or do you just want to exclude two rows if they have exactly the same cost, but with different signs? Note that this is actually something different, take for example the three rows [ john|1, john|2, john|-3 ]? In this case, a pure SQL solution can be achieved using the SQL analytic functions (at least if you are using Oracle).
Elaborate your question. Its not clear if these are columns or rows.
If These are columns:
Create a computed column in your dataset
In Expression builder of that column add/sub values using dataSetRow['col1'] and dataSetRow['col2']
Add only that computed column to your table.
If these are rows
Select rows you don't want to print
Go to properties tab
Find Visibility property and click on it
Check Hide Element option
I have a tablix with the following details:
Apple
Apple
Apple
Mango
Mango
I want to have a subtotal cell having:
Apple: 3
Mango: 2
How to do this without counting the items by id?
Thanks in advance!
Couple of approaches you can use, You can write a query that generates the row count for you - not knowing your data here is an example
SELECT Fruit, COUNT(Fruit) AS NoFruits FROM (SELECT Fruit , 1 AS FruitNo FROM dbo.xxxtblFRUIT) AS a GROUP BY Fruit
Or in SSRS tablix you can create a group and do a count in there.
****UPDATED*****
From what I under stand from your data you can add a row group outside your current group and do the count in that.
Thats what would be returned.
I'm assuming you're still looking for answer to this...
Could you try adding a new table and then using Row Groups to group the data by the values? If we're using the data set from above, you could set the group to "Fruits." You would want your table to have at least two cells, one cell would contain the fruit (Fields!Fruit.Value) and the second cell would have (Count(Fields!SomeOtherColumnInYourDataset.Value). Does this make sense?
The Problem
I'm building an SSRS report which requires regular group headings on certain rows. The data returned from the database query includes a column with a bit flag indicating which rows need to be treated as group subheadings.
Here's a snippet of the source data:
Note the IsGroupHeading column, where the flag is set to 1 on the first row ("0401").
I want to produce output which looks like this Excel mockup:
So every time the report encounters a row where IsGroupHeading equals 1, it generates a bold group heading row followed by a row with column headings.
What's Happening
I've tried creating a row group in SSRS with the expression =Fields!IsGroupHeading.Value = 1 but I get unexpected results: (1) Only the first group heading is treated specially, and (2) the group heading row is repeated underneath the heading. The result looks like this:
Notice that the "0401" row is repeated under the group heading. In addition, only the first group heading ever gets this special treatment. The report simply ignores subsequent group headings and renders them as normal data rows.
The Question
I've spent hours trying to get this right and this is the closest I've been able to get it and my googling on row groups turns up pages mostly about creating subtotals, so I'm throwing this one out to the community hoping some SSRS experts can help me with this.
I'm going to assume that you're doing this in SQL and that all tariff numbers start with the group header tariff number (in this case, 0401).
Let's say your SQL currently looks like this:
SELECT TariffNumber, RowDescription, TariffRate, IsGroupHeading
FROM Tariffs
What we want to do is join this table on itself to give the group TariffNumber and RowDescription columns on each row to enable us to group on it. We also want to exclude the GroupHeader Tariff from the Details rows. So we get something like this:
SELECT TariffGroup.TariffNumber AS GroupNumber, TariffGroup.RowDescription AS GroupDescription,
TariffDetail.TariffNumber, TariffDetail.RowDescription, TariffDetail.TariffRate
FROM Tariffs AS TariffDetail
INNER JOIN Tariffs AS TariffGroup ON TariffGroup.TariffNumber = Left(TariffDetail.TariffNumber, CharIndex(TariffDetail.TariffNumber, '.')-1) AND TariffDetail.IsGroupHeader = 0
Now you just need to group on GroupNumber and you're done.
I have a Matrix style report that I have created and it is currently displaying a total count of items for a series of companies throughout a 12 month period.
[Company1] [Company2] [Etc....] [Total]
[May] (Count)(Percent)
[June]
[Etc]
[Totals]-----------------------------------------------------
The last column total is a subtotal function and automatically adds column counts based on what is in the Column group which in my case gives me a total for both (Count)(Percent)
I only want to show <Count> but I don't find any method of modifying the parameters for the subtotal function.
The only way I found was to add an additional matrix to the right hand side of the main but only display total counts. Kind of hokey and I will refrain from implementing it at this time.
Any suggestions?