Reporting Services :: Using GROUP BY With UNION ALL
May 15, 2015
Here is my sql code. I'm using a "union all" to merge Incidents and Service Requests into one table. This works fine when I don't use the "group by". When using "group by" to get the total number of tickets per "Area" it is giving me duplicates. So it is returning a distinct list of "Area" from both select statements.
SELECT
IRAreaDN.DisplayNameas 'Area'
,Count(IR.Id) as 'Total Requests'
--,IRSupportGroupDN.DisplayNameas 'Support Group'
--, CAST(DATEADD(MI,DATEDIFF(mi,GETUTCDATE(),GETDATE()),IR.CreatedDate) AS DATE)as 'Created Date'
--, CreatedByUser.UserName as 'Created By User ID'
[Code] ....
View 2 Replies
ADVERTISEMENT
Sep 29, 2015
I have an SSRS 2012 table report with groups; each group is broken ie. one group for one page, and there are multiple groups in multiple pages.
'GroupName' column has multiple values - X,Y,Z,......
I need to group 'GroupName' with X,Y,Z,..... ie value X in page 1,value Y in page 2, value Z in page 3...
Now, I need to display another column (ABC) in this table report (outside the group column 'GroupName'); this outside column itself is another column header (not a group header) in the table (report) and it derives its name partly from the 'GroupName' values:
Example:
Value X for GroupName in page 1 will mean, in page 1, column Name of ABC column must be ABC-X Value Y for GroupName in page 2 will mean, in page 2, column Name of ABC column must be ABC-Y Value Z for GroupName in page 3 will mean, in page 3, column Name of
ABC column must be ABC-Z
ie the column name of ABC (Clm ABC) must be dynamic as per the GroupName values (X,Y,Z....)
Page1:
GroupName Clm ABC-X
X
Page2:
GroupName Clm ABC-Y
Y
Page3:
GroupName Clm ABC-Z
Z
I have been able to use First(ReportItems!GroupName.Value) in the Page Header to get GroupNames displayed in each page; I get X in page 1, Y in page 2, Z in page 3.....
However, when I use ReportItems (that refers to a group name) in the Report Body outside the group,
I get the following error:
Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope
I need to get the X, Y, Z ... in each page for the column ABC.
I have been able to use this - First(Fields!GroupName.Value); however, I get ABC-X, ABC-X, ABC-X in each of the pages for the ABC column, instead of ABC-X in page 1, ABC-Y in page 2, ABC-Z in page 3, ...
View 4 Replies
View Related
Nov 6, 2015
I have an SSRS report with groups that when exported to excel contains drill-in's (plus marks on left side). The issue I have is that for all the groups in the drill-in, those cells become merged. I want to keep the group drill-in but have the cells UNMERGED. I have heard this can be done with the RDL XML but I don't know what to modify to accomplish this.
View 4 Replies
View Related
Aug 5, 2015
Struggling to come up with an overall sum for each individual user when using the below code
SELECT
Practice.ibvStaffCategorisation.StaffId
,Practice.ibvStaffTotalsCL2Y.Period
,SUM(Practice.ibvStaffTotalsCL2Y.ChargeableMinutes) AS Sum_ChargeableMinutes
,SUM(Practice.ibvStaffTotalsCL2Y.NonChargeableMinutes) AS Sum_NonChargeableMinutes
[Code] ....
As I am using union all it shows two values for each user, the problem is I am getting the data via lookup like below
=Lookup(Fields!StaffId.Value, Fields!StaffId.Value, Fields!Sum_ChargeableAmount.Value, "ABSTimeRollingY")
I don't think I can use a Sum within a lookup so at the moment it is only bringing through the first value for each user but I would like it to bring through both.
Is there a way to do this within the dataset or via the query in the table?
View 2 Replies
View Related
Oct 19, 2015
I have a report which display
Group value col1 Per %
1 188
2 109 109/188 = 58%
3 48 48/109 = 26%
I know we can do it using lead and Lag in SQL but i have complex agregates in sql so, i have to do it in ssrs report. How can I do this in ssrs ?
View 3 Replies
View Related
Jul 14, 2015
Sales Representative: ABC
"CustomerID"Company NameEmail AddressJun 2015Jul 2015
5033397TOPS FOR SHOESsales@topsforshoes.com$654.85$476.01
5034550Goodnightiesmarcia@goodnighties.com$538.80$295.93
5060377United States Lighting Corpjim@uslightingcorp.com$998.71$658.93
5084043mark Bettencourtbetten1@aol.com$70.97$60.07
5084382Arcana Empothecaryjames@arcanaempothecary.com$2,295.97$2,718.05
5098491Tony WisenTony.Wisen@EDMSupplies.com$40.69$94.37
5099747Crest Ridge Saddlerysaddles@crestridgesaddlery.com$733.86$518.63
5103478Ann Aurburndps@nhicwestmi.com$258.62$289.91
5110483Intimidation Clothing, LLCluke@intimidation-clothing.com$145.28$138.42
Total $5,737.75$5,250.32
I have dataset ready having sales rep ID and other column like customer ID, company name, Email adress and transaction month as shown above how can i make a row group by sales rep id and each tab (when we export report to excel) I mean one tab for A sales repID , another tab for B...I did row group parent group and group by sales repID but not working as expected.
View 3 Replies
View Related
Aug 6, 2015
I would like to generate the report for finance office to pay the salary for each staff.
I have some mass data in SQL server
STAFFCODE TIME TYPE
101 31/1/1900 09:00:00 IN
101 1/2/1900 03:02:00 OUT
102 31/1/1900 09:00:00 IN
102 31/1/1900 19:23:00 OUT
I would like to calculate each staff each month working minutes.
MONTH STAFFCODE WORKING_MINS
JAN/1900 101 900
JAN/1900 102 623
FEB/1900 101 182
View 7 Replies
View Related
Aug 17, 2015
I have an SSRS report with 2 Row Groups and 2 Column Groups. A total row appears before the detail when I run the report. I'm not sure why it appears or how to remove it.Generally, I'll click on a group, add a total row before or after, and then a line is inserted with "Total" labeled. That's not what is happening here, I see now total row, it just appears when previewed.
View 3 Replies
View Related
May 20, 2015
I have row group created here on Due Month & Sales Region & added total after Due Month. When a user clicks on particular amount I would like to send the Sales Region value to the new report as Parameter. So Instead of Total text , I would like to have all the sales regions concatenated and sent to the new report. writing an expression to get the report parameter? I have added the picture of how I want the values to be concatenated , instead of Total . Is this not possible in SSRS?
View 5 Replies
View Related
Oct 29, 2015
I have one row group in report which is on stage
format like ..
Stage Files
I 10
O 20
U 30
T 40
Now the files are coming by forming group on stage.
here , stage I has 10 files coming and i have one column with these rows as TYPE_Id which is either 1 or 2 now i want to build an expression to see if the files have included such file which has files type 2 and if number >1 then i want to return a flag ..
i had tried iif but it is returns same if files contain of type 2 or not .
how to write a expression which tell me that these stage files has type_ID =2 files
View 2 Replies
View Related
Oct 28, 2015
I have done Column Level Group By on FY Column.Here i would like to get Fy 16 Prior Year Remaining amount from this formula (FY 15 Prior Amount + FY 15 Capital - FY 15 Expenditure). If I calculate as group variable its applicable only to that FY as I cant get from previous year FY.
View 6 Replies
View Related
Jul 26, 2015
I want a sum of the rows I have but only the unique items, for example
Client Name Amount
Client 1 $10
Client 2 $20
Client 2 $20
Client 3 $30
Client 4 $40
Client 4 $40
Client 4 $40
I want the sum of this to be Client 1 + Client 2 + Client 3 + Client 4 which is $100. But if I just do a sum it adds up each row. I also have them grouped together, so when it's shown, I only seen one of each item, but a sum still grabs all the duplicates.How can I go about getting the unique sum
View 6 Replies
View Related
Jun 8, 2015
I have got question because time is running but I still don't know how to do it.
So I have 1 group with 3 rows and I would like to put for each row not only group individual number like 1,2,3,4,5 ... etc until end of report. Generally using fuction RowNumber I got 1,2,3 and then 1,2,3 again.
View 9 Replies
View Related
Apr 14, 2011
How to select the max row/date per group. I am planing to do at report design level(i.e, trying to put filter condition in group properties).
View 2 Replies
View Related
Aug 18, 2015
Please zoom your browser to 200% to make the images clearer. Notice that the left and right edges of the parent Month column in the second example are 2pt black and the inner edges of Forecast, Budget and Actual are 1 point light gray.
View 4 Replies
View Related
May 21, 2015
I have several row groups in a tablix. I want to keep header visible through scrolling.and i also want the first row group to visible, only the first.
So I set the first row group's properties fixedData to TRUE and keep other row groups to FALSE then when running the report i got error "FixedData is not allowed in row TablixMember,unless it is also set on the first row TablixMember"
Now I think this is not possible. or is there anyway to make it works?
View 5 Replies
View Related
Jun 26, 2015
I am trying to build a report using SSRS.I need to retrieve a distinct value from my initial query and place this in the header or group row.The detail lines are hidden but may be expanded(shown).I then have another group row in which I require the sum of all distinct values from my previous group row.To explain pictorially I have the following:
-Scroll right to see the pink squares.Note that the total in the pink square is the sum of the individual var3 values distinct so 10 even when var3 =4 in euro currency.
-I have tried using sum(var5) but this will give the incorrect value as it sums all detail lines not just the distinct values.
-I have tried using another dataset but when referenced the grouping behaviour expected is non existent so where I expect 40 I get 80 i.e. sum disregarding values of var1 and var2 although these are the grouping variables.
-I need it to be dynamic so I am unable to use IIF(...).
If I could get var4 or var6 to be the totals I require I could work with that.I have also tried the following custom code:
Dim public unitLimit as Double
Public Function Getcpvalue(ByVal limit_amount1 AS Double) AS Double
unitLimit = unitLimit+ limit_amount1
return limit_amount1
End Function
[code]...
View 2 Replies
View Related
May 15, 2015
Below are screenshots from my report
When a user clicks on a amount it should pass the sales regions , so that the a new detailed report opens up. Sales regions are passed when the report is in expanded view like on the right. But when its collapsed it just passes only the top most value and not all the sales region to the detailed report.
I've set this value as parameter to the detailed report
=Fields!SalesRegion.Value
How do I change this so that all the sales regions from the selected row group are passed when collapsed? I've uploaded the image in case the page does not show up.
View 2 Replies
View Related
May 25, 2015
I am new to SSRS. I created a reporting services with 3 groups. I would like to know how to create different colors for each group so that all my values displayed by color group ?.
View 4 Replies
View Related
May 18, 2015
I have a table with a row group "Sales Area" that lists customers per sales area. There is one column with the sales per customer and another column with the planned sales per customer.A third column "Under Plan" is a simple calculation that compares the two Report Items of the sales to the plan and puts a 1 there if plan is higher. My issue is how to get the total of the group "Sales Area", to display the group total of all customers that are under plan. SSRS doesn't let me use aggregate functions on group totals;Unfortunately I cannot pre-calculate the "Under Plan" figure in the query, since this example is a simplified overview (the customers is a distinct count for example...)
View 5 Replies
View Related
Mar 25, 2015
I have a requirement where i am converting a Crystal report into SSRS.
My data contains different groups where some of the sections should be suppressed based on Drill down group level.In crystal they are using DrillDownGroupLevel <> 1 .
View 6 Replies
View Related
May 14, 2015
Table here shows partial data extract in order I want to see the report. I need to report:
part-a full, 8 layer, 7 layer, 6 layer....
Part-b full, 8 layer, 7 layer, 6 layer....
part-a full, 8 layer, 7 layer, 6 layer....
Part_Number
Pal_num
MFGDate
Shifttime
WorkCen
[Code] ....
if I group by part number, I get a total. I need a 'sub-total' by part as each group is produced.
Report should be:
Part FULL 8layer 7layer 6layer 5layer
4layer.....
604-04043 6 1
604-02057 14
604-04043 7
View 3 Replies
View Related
Oct 27, 2015
I have a field on my report that uses the following expression to determine the commission amount for each order line. It works correctly to get the commission amount for each line, however, I need to get a total of the commission amount for each Salesperson.
My report is grouped in the following manner:
Salesperson, Type of Sale, Invoice Number, then the detail invoice line items (where the formula below reside). How can I get the totals for the Salesperson and the Type of Sale?
=IIF(Fields!PartIsSerialized.Value=True, (Sum(Fields!OrderLineSubtotal.Value)/Fields!Quantity.Value),Sum(Fields!OrderLineSubtotal.Value))
*
IIF(
Fields!TransactionType.Value Like "*USED*", (Parameters!CommissionRateUsed.Value*.01),
[Code] ....
View 2 Replies
View Related
Mar 8, 2007
I have an expression in a group that calculates a percentage of sales:
=iif(Sum(Fields!BOOKD.Value)=0,0,IIF(Sum(Fields!NET.Value)=0,0,((Sum(Fields!BOOKD.Value)-Sum(Fields!NET.Value))/Sum(Fields!BOOKD.Value))))*100
If there is a 0 balance for both the book dollar and the net dollar the expression returns #Error.
I have made sure that if the value is null it should return a 0 in the initial query.
,SUM(ISNULL(R.BOOKD,0)) BOOKD
,SUM(ISNULL(R.NET,0)) NET
Any suggestions would be greatly appreciated.
View 1 Replies
View Related
Apr 21, 2015
I have report showing sales by Vendor. I need to list all the vendors with Monthly Total>5000 and combine the rest as "OTHER VENDORS"
Vendor is a Group in my report, so I tried to put an expression as a Group on:
=IIF(Sum(Fields!Mth_1_Sales.Value)>5000,Fields!Vendor_No.Value,"OTHER VENDORS")
I've got an error: "aggregate functions cannot be used in group expressions"
How do I get Vendors with Sales < 5000 into "OTHER VENDORS" ?
View 4 Replies
View Related
May 28, 2015
I am new to matrixes and I have created a dataset which I would like to populate into an expanding / collapsing matrix.
The purpose of the report is to show a list of pallets and their respective stock adjustments. I have laid the matrix out as follows...
I have spent the entire afternoon playing around with this and searching Google, but as yet, I have been unable to get the matrix to display more than 1 record per pallet. Each of the pallets below have multiple adjustment records, yet the report will only display the first one...
If I assign the dataset to a table, it displays as expected.
View 8 Replies
View Related
Nov 23, 2015
I have a report with two groups and a detail row (subtotals & totals to follow). When I add the child (detail row) it pushes out to the right of the parent column. Is there any way to start the detail row all the way back to the left hand side of the page? I lose a lot or real estate with the group descriptions.
View 5 Replies
View Related
Jun 15, 2015
Here's what I need to do..
1. I have a dataset with userID's
2. I want to only show the records where a userID is a member of a specific AD group,
I'm not allowed to use a linked server. I was able to make a datasource in SSDT that connects to AD, but I don't know where to begin with the dataset expression in the SSRS report.
View 7 Replies
View Related
Oct 5, 2007
I have a chart that I am grouping data by Year, Month, day then Hour (this is to view server performance data) - however i need the label for the hour grouping to be in the format of HH:MM and not H:M by using expression
=HOUR(Fields!Timestamp_perfmon.Value) &":"&MINUTE(Fields!Timestamp_perfmon.Value)
...but this as you would kind of expect returns 0-23:0-5 ie 18:1 whereas i need it to return 18:12 or 8:12 PM..
when i change the format code for the x-axis it unfortunatey screws up all my other group by values and labels..
can anyone help?
View 2 Replies
View Related
Aug 5, 2015
I am creating a subscription to deliver reports via email on SSRS. One of the problems I am having is I can't add groups to the To: or Cc: fields for report distribution. I am able to add individual user email which works fine but it will be a lot of emails to add if I have to go that route. So how do you add groups to report subscriptions?
View 2 Replies
View Related
May 13, 2015
I have a ssrs report with Name, phone ,state and city as columns. I have check box as one of my parameter(optional). If user checks that checkbox then it should group by state, if checkbox is left blank no need to do any grouping. How can i do this in ssrs 2012.
View 3 Replies
View Related
Aug 11, 2015
I have a table where I am grouping on one field and would like an individual (separate) count of values from another field of same table. So for example, I have following data:
instance_id, area, values
101 North 1
102 North 2
103 East 2
104 East 2
I would like to report on Area, and count of rows with different Values types, for example:
Area Value - 1, Value - 2, Value - 3
North 1 1 0
East 0 2 0
I am not sure what the technical term is for such report, but I can group by Area column, and but its aggregating counts on different Value types that I am having difficulty in performing in SSRS.
View 2 Replies
View Related
Nov 2, 2015
I developed a main report containing numerous subreports. But now I'm trying to page break on these subreports and because these subreports all have sub-sub reports, I get this error when I try to run this report..The value '22' is invalid. Valid values are between '0' and '1'. (rrRenderingError)..I am grouping on uniqueidentifers and I do not get errors on subreports that have sub-subreports. How can I avoid this error and get these subreports to page break? (I don't get any errors if I remove the page breaks).
View 3 Replies
View Related