Hiding Subtotal Rows When There Is Only 1 Row In The Group
Feb 13, 2007
How could one do this? I understand you could use the COUNT() function, but I'm not sure which object's visibility would best support this. All that I've tried (subtotal area, group visibility) do not seem to work.
If you change the visible property on the subtotal textbox that RS adds, it will only 'blank out' the area where the subtotal row would have been - this doesn't achieve the desired effect of saving space.
I have a table with a group. I have one row of the group that is the header for the detail section. How can I suppress the row header in the group if there is no data in the detail section for a group value? I was thinking something along the line of setting the visibilty of the row header to an expression based on the existence of data in the detail, but don't know how to go about this.
Hi. First, I am VERY new to SQL Queries and Reporting. A co-worker is "mentoring" me, but I am trying not to fill his day with questions.
I HAVE read the help files, searched the forums, looked at books, and done general web searches, but any answers I have found have either no addressed my issue, or the answers are way over my head.
Furthermore, the (SQL 2000) DB is built into proprietary software (ISS Proventia Intrusion Prevention System), and the database may NOT be modified outside of the software.
With that said, I am querying multiple tables within the DB. I am using Business Intelligence Dev Studio, and placing my queries on a reporting server maintained by my co-worker. My goal is not only to get a solution, but also to UNDERSTAND it so I can continue to learn. Of course, the solution takes precedence over my understanding!
My Primary key is dbo.SensorData1.SensorDataID. dbo.SensorDataAVP.AttributeText returns a different number of rows, containing different data depending upon the value of dbo.SensorData1.AlertName. I need to return all rows, hence the Left Joins.
Depending upon my query, I might have 1000 events, and due to the many rows of data from dbo.SensorData1.AlertName I might return 20,000 rows (or more.)
I would like to return a report that "groups" events by dbo.SensorData1.SensorDataID., BUT, rather than simply providing these in groups, provides me single rows with a plus sign next to each even, that can be expanded for the additional data.
My co-worker has discussed sub-tables, but since I cannot modify the DB, it will be difficult / complex to do so, AND, for me to understand.
One of my queries follows. I have thirteen queries, total, that use various groupings of attributes. I have chosen one of the more complex combinations so I can generally apply the concept to the queries with fewer parameters more easily.
Note, I'll be asking the same question on www.sqlservercentral.com in the hopes of getting an answer I can understand one of these two places - If you answer here, there's obviously no need answering there answering there.
Let me first describe my report: I have the following table
Header Group 1 row--There is a textbox that in this row that when toggled makes visible the two below group 1 rows and the detail row. Group 1 row Group 1 row Detail row Group 2 row-- This row has a textbox that can hide the below group 2 row. Group 2 row-- This row contains a subreport.
Currently, I have a parameter that allows the user to conditionally collapse or show the tables' information for printing purposes so the user doesn't have to go through and click on so many plus signs. My problem is I would like to use a parameter to conditionally hide both of the Group 2 rows so that the user cannot view or click on them. The information in Group 2 is extra and not always needed, so I would like to provide the user with a way to hide this information when they go to view the report. However, I imagined this would be easy enough. I went to group2's visibility tab through the table interface and set the expression to "=IIF(Parameter!ShowIndexes.Value, FALSE, TRUE)". However, when I view the report the report is hiding the detail information as well as the Group2 rows.
I have several nested sub-total groups. Depending on a report parameter, I may want to suppress one of the sub-totals. This one group is not the lowest group in the hierarchy and, when I hide it, all the groups "below" it become hidden too. I only want the one group to "disappear", not any others. Is there a way to accomplish this other than creating two versions of the report?
Using SQL 2000 Report Designer & Visual Studio 2003 and a report for MS CRM 3.0
I need to group by Year + Month, like now would be "2008 02". Am using the FilteredOpportunity.estimatedclosedate. I have tried using YEAR(FilteredOpportunity.estimatedclosedate)+MONTH( FilteredOpportunity.estimatedclosedate), but does not work. Also YEAR( FilteredOpportunity.estimatedclosedate.Value). I don't store "2008 02" type data in the CRM.
how to add group subtotal and grand total in report? i try to add formula Sum(Field!Net_Weight.Value) in group footer and unable repeat footer on each page, it return same total on every pages. I hope to get subtotal on each page by group. the expected result would be like this:
Hello Friends, I have created a report using SSRS and in that report I am using group rows in one of the matrix. When I tried to display the subtotal of that group row by using the SSRS in-built feature the subtotal column is coming at the last of the matrix columns but the subtotal its showing is wrong . Its just giving the value of the first columns value.
I'm dealing w/ SSRS 2005. I have my main matrix report which has five row groups.
What I'd like to do is have the subtotal at the 4th level have a coloring for the whole row at run-time....so the user can follow from left to right what the 4th level subtotal actually is (the report can get fairly wide).
At design time, you don't even see the rows to the right of the subtotal, you just see the subtotal box.
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
Hi.The situation is:I'm showing OLAP Cube in OWC11. One of Parent-Child dimmensions (for example employees(menager->menager2->employee)) is viewed as Rows. Employees have attribute "City" (where they live). City can be selected from other dimmension. There are so meny of Employees that I have to hide empty rows. The problem is: When I select City in my filter dimmension, Parent members of Employees dimmension from other Cities are hiden even if their leaf members are from selected City. What Can I do to wiew all members of Employee dimmension who are friom selected City no mater in which level they are?? Any Ideas? I'm using Analysis Servicess 2000 SP3. Office web components are docked in web application so I can't programm it. MS Analysis Menager is handling this without problem (showing leaf members next to its parent even if parent is blank). This is realy urgent! Please help! BTW Sorry for my English ;)
Campaign and Area are all selectable by parameters, so the actual number of rows is dynamic. What I would like to do is an additional aggregates other then sum for the total - things like average, percent to goal, etc.
And this is where, either I'm completely missing something, or SSRS and I have a huge communication breakdown . I absolutely cannot seem to do this. I tried adding additional columns, but they are grouped under area, not after it - in the above example, it would result in three new columns, one for each area type, not 1. Confusing to describe, but looks something like:
Area1 Area2 Area3 Total Sum Avg Sum Avg Sum Avg CampaignType1 1 xx CampaignType2 2 yy CampaignType3 3 zz Total
I hope that conveys the idea w/o having to fill it all in.
I'm lost as to how to get this accomplished. All I can think of is adding a union dummy row into the actual stored proc to make a different area type (say, AreaAverage) just to add in an additional column and that make sure it sorts at the end. That screams hack to me. Any help????
I'm new to MSSQL 2005 and want to get a summary of a log table. I want to count all the rows for each date based on a DATETIME field called 'post_date' that holds the date and time of each record's creation.
this is the best I can come up with:
Code:
SELECT DISTINCT(LEFT(post_date,11)) AS post_date, COUNT(DISTINCT(LEFT(post_date,11))) AS total_posts FROM log_directory_contacts GROUP BY post_date
The results show each date but the count column ('total_posts') returns '1' for every row even when I know their are more than 1 record on that date.
My report has two groups, company and error type for each company. Company1
Functional Error Data Error Other Error My goal is to show the subtotals for each error types when I show Company's subtotal/total; in the group 1 footer area. Total for Functional Error: Total for Data Error: Total for Company1:
Hi,I'm trying to build a query that get only one row from a group ofrows, but I need the values from that row and not the results of onefunction group.I need one row for each idRef, with column2=2 and the bigger column1id |idRef | column1 | column21 1 0 12 1 1 23 1 2 14 2 0 15 2 1 26 2 2 17 2 3 2For these, I will take the rows with id=2 and id=7.Thank you, and sory for my english.
Okay, I am sure this is an easy question, but for some reason I cannot wrap my brain around it. I have a table that has data similar to the following:
IPAddress VisitDate URLVisited
192.154.21.554 9/18/2007 http://www.microsoft.com
192.154.21.554 9/19/2007 http://www.google.com
164.21.124.23 9/19/2007 http://www.microsoft.com
192.154.21.554 9/20/2007 http://www.yahoo.com
What I am trying to do is use a select query to find the most recent visit per IP address (but I also want the other row data like URL visited). I have something like this that is finding the most recent visit per IP address:
SELECT IPAddress, MAX(VisitDate) AS MaxDateVisited FROM VisitorTable GROUP BY IPAddress
How do I also pull in the URL that is associated with the MAX date visited? Thank you!
Hi, I am trying to get the first row of what might be a group of any size of rows within an id that may contain a specific field. For eg
Row A = NoteID 1, FK_JobID 1, UnRead
Row B = NoteID 2, FK_JobID 1, UnRead
Row C = NoteID 3, FK_JobID 1, UnRead
I need the sql to return to just one Job (row) even though the job as 3 UnRead fields. But its returning 3 because its only doing what I'm asking. What I need it to do is just get the one Job (row) where any of the notes = UnRead.
I tried using Top 1, but that will only ever return one row and since I need it to return more than one job (row) it won't work.
Heres my attempt
DECLARE @UserID INT
SET @UserID = 4
SELECT User_Notes.BeenRead, Master_Jobs.By_Who, Master_Jobs.Next_Action, Master_Jobs.Due_Time, Master_Jobs.Due_Date, Master_Jobs.Contact, Master_Jobs.Job_Title, Master_Jobs.JobID FROM User_Notes INNER JOIN Note ON User_Notes.FK_UN_NoteID = Note.NoteID INNER JOIN Master_Jobs ON Note.FK_JobID = Master_Jobs.JobID
WHERE Note.FK_UserID = User_Notes.FK_UN_UserID AND BeenRead = 'UnRead'
creating a query to group identical rows into one and placing corresponding data in appropriate columns for a table named items, what I mean is that I have a table structured as below
As you can see each room is assigned and id and once the room changes the id starts from 1 again. I don't want the 2nd row to appear because 9am - 1pm is in 8am - 5pm. How do I remove this row?
My first post on the forum, I wish I had found this place sooner, looks to be full of good advice and knowledgeable posters.
I have tried searching and looking at the FAQ's but couldn't find an answer. So here goes, all help greatly appreciated.
SQL Server 2005
Table (many columns left out for simplicity)
ID - unique. HdrID - key to the header record. PTtimestamp - date, date/time the row was written to DB. PType - integer, representing various states of the row. etc etc etc (another 15 columns of data)....
Typically there is approximately 250 records per HdrID.
I am trying to do an SQL UPDATE without using my usual solution of writing vb code!
I want to update the PType of latest row (as per timestamp) for each HdrID to -9999.
I built a report with one field as a group. I want to count the number of rows in each field so I can add it to the group field or somw where in the report.
How can I count how many rows do I have in each group?
Hi everyone: I guess this should be a simple question but have not been able to find the answer, does anyone know how to make a SQL Sentence to return at least one row when counting? SELECT COUNT(Id_Field), Field2 FROM Table1 WHERE Code_Field = 1 GROUP BY Field2 This will return 0 rows when the where criteria is not matched by any record on the Table1, but I would like to have one row counting 0 rows, in stead it returns no rows at all. Thanks for any help.
hi, i have a stored procedure SELECT UserName AS Visitor, COUNT(VisitID) AS TotalVisit FROM UserVisits WHERE (ProductID = @ProductID) AND (AnonimIP IS NULL) GROUP BY UserName UNION SELECT AnonimIP AS Visitor, COUNT(VisitID) AS TotalVisit FROM UserVisits AS UserVisits_1 WHERE (ProductID = @ProductID) AND (UserName IS NULL) GROUP BY AnonimIP this will return something like: zuperboy90 - 4 visits ANONIMOUS - 6 visits 85.104.103 - 2 visits etc how can i count the rows returned in both selections (4+6+2 = 12) ? thank you
I have posted this in the Experts Forum so I have put replies to questions in here as well (Hence the long post!!). Hope someone here can help!!
I am having trouble with a T-SQL query. I have three tables in a join and I need to limit the results returned by query using a group by.
All of the fields in the result group are the same except for two fields, a date field and a varchar field. What I want to achieve is to return the row that has the latest date, and I need the varchar field as that is the information I am after. The problem is if I include the varchar field in the group by, it is returned as a separate group, if I do not included it in the group by, Server: Msg 8120 (aggregate fn / group by) error occurs!
Any ideas how to get around this?
Sample code and results below:
Query:
select distinct s.id, [active-from], code, s.desc, [scheme], [market-id], [market-id]+'CODE' from [coded] c join sec s on s.id = c.id join [mkt-security] m on m.id = s.id where ([market-id] = [scheme] or [market-id]+'CODE' = [scheme]) Group by s.id, [active-from], code, s.desc, [scheme], [market-id], [market-id]+'CODE'
i.e. those with the latest [active-from] date, but I must have the corresponding code value.
I have tried a correlated sub query on the [active-from] field, but it is possible to have different id’s with the same [active-from] date so it did not work.
The primary key for the [coded] table is the combination of [active-from], code and [scheme]. The tables are truncated and then imported back into the SQL database from a Progress database daily, so restructuring the table(s) is not a possibility.
I have rewritten the query to "AND [ACTIVE_FROM] in (SELECT MAX([ACTIVE_FROM]) FROM CODED AND MAX([CODE]) = S.[CODE] AND MAX([SCHEME]) = S.[SCHEME]", (Which I think is the T-SQL for you query), but it returned the error "An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference."
Also I think the query need to use a Group by as the results I need returned are those with the latest [ACTIVE_FROM] date WITHIN the group of [ID]and [MARKET-ID]. I can't think of any conditions where I can filter the results in the where clause.
The [ ] in the T-SQL is to identify table names as some of the table names (from the Progress db) use characters (the "-") that are unsupported for table names in T-SQL.
I am using the group by as I want to return specific groups of results ( [ID] and [MARKET-ID] ), that have the latest active-from date. I have made a change to that posted before to illustrate:
I have a table, Table1 with 3 columns as follows: colItemKey, colGrouping1, colGrouping2. colItemKey is the primary key. Say colGrouping1 has 4 different types: Grp1A, Grp1B, Grp1C and Grp1D and colGrouping2 has 5 as follows: Grp2A, Grp2B, Grp2C, Grp2D and Grp2E. How do I setup my select so that the result set is as follows: