SSRS Totaling column with many groups - sql-server

I have an SSRS report thats query returns many results. They are grouped to aggregate them by item group and division, as well as a couple of other groups. Whats happening is the total line is taking the total for ALL of the result lines instead of the grouped lines.
I have tried adding a scope to the sum expression in the report but to no avail. All I really need it to do is sum up the visible columns.
Heres a shot of my groups:
If i run the report, look at the totals for the columns, they are way off:
This should be 29,329 but it is (i believe) totaling everything outside of the groups.
Is there a way to just sum the column so I can get the amount desired?

You may need to recreate your groups again.
from the looks of your diagram, your total row is Outside your group Item_Process_Group, so the [sum(Sales_Quantity)] is summing all groups (as your comment suggest.
If your total ([sum(Sales_Quantity)]) was on the (empty)cell above where its displayed on the pic above, it should total correctly

Related

How to stop Heap Analytics grouping assets into "OTHER" Category

I think this might be very simple.
I wrote a query in heap to tell me which users were part of an event and how many times they engaged in it during the year.
The result is a simple table with username and number of occurrences.
It worked. However, Heap has this weird behavior of choosing multiple results (maybe at random?) and throwing them into a single "Other (X other results)" category. Where x is a number of others.
So i end up with a table of 20 maybe 30 users and occurences, and one row of "Other (X other results)".
I shrunk the query to see results from a smaller subset of dates and the "Other" category disappeared.
I really need to see every individual row in my query results! Even if it's paginated.
Help! Thank you
You can export the result as a CSV. The downloaded file will contain all the results (all single entries without the grouped OTHER).
Inte the current UI, you can find Export to CSV at the top of the report view.

Ssrs reports Windows 2008

I'm fairly new to SQL and I have been issued my first report to build. I have written an SQL query to give me a set of results that I would like to publish in a report.
I have unioned about 20 small queries all containing the correct amount of columns. One column is a misc column with about 15 different descriptions in (this is what I want to count).
I have uploaded my data set and now want to be able to choose a cell in my report to bring back a certain description.
At the minute I'm using
=count(fields!misc.values)
and it's giving me the whole count, about 200.
I would like to know if there is any kind of "where clause" (filter) which I can use to state which description results I want to bring back.
You can use am expression to count the misc.value you need. It will work like a count using a where clause:
=Sum(iif(Fields!misc.Value ="Some description",1,0))
Example:
For count the FSMethod with MethodOne as value I used this expression:
=Sum(iif(Fields!FSMethod.Value ="MethodOne",1,0))
Note the expression sums by 1 if the FSMethod.Value is MethodOne.
For count the rows with FSMethod column with MethodTwo value.
=Sum(iif(Fields!FSMethod.Value ="MethodTwo",1,0))
Let me know if this can help you.

Generating Working Hours using SQL Server Query

I have this data and I need to generate a query that will give the output below
You can do this kind of groupings of rows with 2 separate row_number()s. Have 1 for all the data, ordered by date and second one ordered by code and date. To get the groups separated from the data, use the difference between these 2 row_number()s. When it changes, then it's a new block of data. You can then use that number in group by and take the minimum / maximum dates for each of them.
For the final layout you can use pivot or sum + case, most likely you want to have a new row_number for getting the rows aligned properly. Depending if you can have data missing / not matching you'll need probably additional checks.

SSRS Cumulative Running Values

So I am attempting to reorganize a report I put together. I had the running totals working before the redesign, but I have been pouring over this for a day and can't figure out why it is no longer functioning as I had thought.
The sum values are correct here, but it keeps accumulating them and not spreading them out over the area paths I've defined (which are populating obviously).
I have the sprint and area name linked in a hierarchy for the row groups then followed by this expression:
=RunningValue(Fields!Sev_1_Count.Value, SUM, "RowGroup")
Each column after the area name is defining a severity level of defects, just for context. The Sev_1_Count expression should take the count of all defects in this severity level then spread them across their associated area names. Which worked in the previous version... I just can't for the life of me figure why it won't work now. Thoughts?
I think the problem is that you're applying the running total to each field. It seems that wherever you're putting
RunningValue(Fields!Sev_1_Count.Value, SUM, "RowGroup")
you should just have
Fields!Sev_1_Count.Value
instead. As you need totals on both sides, you should have a matrix and the right and bottom rows of you columns should be outside the group "Iteration Name" with a value of
sum(Fields!Sev_1_Count.Value).
Not sure what I'm missing. Maybe your original dataset is set up in a way where you can't do that?
Your row groups should be grouped on name and your column groups should be grouped on severity level.
I'm not sure what you mean by your comment below Randy, but the best practice for something like this would be to have a data-set that consists of 3 fields:
"EnvironmentName", "DefectCount" and "SeverityLevel". Then in your matrix, you have the DefectCount as your Details, EnvironmentName as your RowGroup and SeverityLevel as your ColumnGroup. Then the right column and bottom row are placed outside the groups and have the value of Sum(DefectCount). Anything outside of that seems like an over-complication.
It seems like you want to use running total to add the columns for severity levels if i'm not mistaken? then you shouldn't be grouping them on rows. Instead of the "RowGroup" scope, maybe you should try None. Good luck.

SQL Server Reports Aggregate Functions

G'day,
I'm a total n00b when it comes to SQL Server reports and my Vb.Net knowledge is ageing now.
I have a detailed report of rows in a database, with one of the columns that is nullable. What I want to do is show a simple pie chart over the data in the result which shows how many rows have a value and how many do not.
I can't work out how to write the Count() aggregate in the expression for the data series so that it filters.
eg.
I have 10000 rows of which 2000 have a null. I want a pie chart that shows two results, one small pie chunk with 2000 and a larger pie chunk with 8000. When I try and do =Count(IsDbNull(Fields!TransactionID.Value)) and =Count(Not IsDbNull(Fields!TransactionID.Value)) it appears to send the same result twice, ie. the result set is still the same size it just consists of trues and falses.
Cheers for your help.
Since you are using COUNT you are just counting values; IsDbNULL is returning TRUE or FALSE both of which are being counted.
Try doing this for the Non-NULLS =SUM(IIF(ISNOTHING(Fields! TransactionID.Value),0,1)) and for the NULLs use =SUM(IIF(ISNOTHING(Fields! TransactionID.Value),1,0))
Actually, for the non-NULLs you can just use COUNT(Fields!TransactionID.Value)
I'd use something like this
-SUM(CInt(IsDbNull(Fields!TransactionID.Value)))
COUNT(Fields!TransactionID.Value) + SUM(CInt(NOTIsDbNull(Fields!TransactionID.Value)))
COUNT literally counts values, same as SQL Sever. So:
IsDBNull gives true/false -> -1/0 -> SUM that gives you number of NULLs (minus of course)
Then take full count, subtract the SUM gives non-NULL count

Resources