How to add a field to a report that has groups - sql

I need to add a field to a SSRS report. I tried modifying the dataset (query) but the results prouduced insane results, with zipcodes showing up in the name fields and names showing up in a datetime field. I suspect it is because of the groups but I don't understand how they work. The Dataset is created by 4 selects. The first 3 insert into temp tables and the fourth pulls from it. I suspect that I will have to re-write the query but it would be nice if I could use it as is with modifications. Either way I need to understand the groups.
I read
Data Region Cells, Data Region and Understanding Groups. Aside from the fact that they use terms specific to SSRS without defining them they are so undetailed I doubt many people who do not already understand SSRS can get anything out of them.
I did not write this report but I must modify it. I understand SQL well. Not so much with SSRS.
Can anyone explain how to find out what the Row Groups mean? Mine look like this:
Here is the tablix

Related

Why are my TABLEAU table aggregation attempts ignoring my filter?

See attached image. Via Coursera, I am new to Tableau so what I am attempting to do seems it should be rather simple to do but isn't (not intuitively so). I'm familiar enough with SQL to wrangle my way around subqueries and case statements and such, but Tableau feels far more clunky most of the time.
Screenshot of Tableau worksheet table
I simply want to aggregate the dollar amounts listed on the right, SUM'ed across each City partition. Each city has a number of properties that have already been purposely filtered out, based on their profit Rank (via calculated fields) being too low. I've tried all sorts of things, but *the issue I'm facing is that the closest I can get is that any SUM I do lumps in the properties that were filtered out despite the filter remaining in place on the Filter card *. (I think I got a Running_Sum to yield the correct city totals a couple of times, but I couldn't get it to only show a single row of the final value for each city.)
I've tried countless variations and combinations of Include, Exclude, Fixed, Case, If, some nested via one or more of them, some not nested at all, some within a single calculated field, some spread out across multiple calculated fields...and often getting errors regarding not being able to mix aggregates and non-aggregates, being required to use aggregates in LODs but not being able to do so with IF statements, etc. But again, the times I've been able to get it to "work" error-free, I get the SUM across all properties in the city..not just the ones in the 'INVEST' category that the filter suddenly ignores after any error-free modification attempts to what is seen here.
Any help regarding this specific issue would be greatly appreciated, but a more general understanding of how to keep filters from being conditionally ignored by Tableau would be great. Sometimes the filter variable's second category would disappear as an option altogether while Tableau would still use rows from that category in the calculation. What gives? Thanks!

Static Values from Multiple Queries/Datasets in Single SSRS Tablix

ok so I have this report I have to write in SSRS with a very specific format. It looks like the screenshot below at the bottom. Ignore the arrows and colors. It's pulling from an Oracle database. Each number value cell in this table/matrix has a different sql query to pull it in because they come from different tables, etc.
the top half of the numbers in the table are each from a query. the bottom half of the table is all calculations from the numbers in the top half. I already have the queries for the top half and was trying to figure out how I could just use those to make this table in SSRS with just those and then creating calculations in the bottom half for the report. I can't use a table or a matrix because each query is a different dataset and you can only have one dataset per tablix.
I was thinking maybe doing textboxes and drawing the grid manually, which would be a huge pain. I get errors about not having an aggregate and being out of scope or something and haven't figured out the reason for this yet as it is not my ideal solution.
My current solultion that will eventually get me there is unioning every single query and then creating columns with static values for the rows and columns in the grid and turning it into a matrix. Problem with this is it continues to increase in complexity as I create each further down the table calculation, and the code becomes larger and larger, and takes a long time to create, and I have to do like 6 reports similar in nature to the format of this one. Will probably be a thousand lines of sql and force me to have to make a stored proc because of the ssrs character limitation.;
So my question in a more simple way is, how can I take multiple sql queries that return a static value and make them a single value in a tablix that doesn't repeat, then create more blank rows in that tablix that are calculations of other cells values, i.e. Textbox1 - textbox2, textbox3/textbox4 ?
I got it figured out using expressions with multiple datasets. The answer seemed too easy once I found it. Basically just created a table tablix using my first dataset. Created more detail rows with insert row inside group below. Then I went to the expression builder for each one and found the other dataset and double clicked it to get the expression to pull from the other dataset. For example the bac_labor dataset value would look like this. =Sum(Fields!BAC_LABOR.Value, "BAC_Labor")
Then for calculations can use either same thing like =Sum(Fields!BAC_LABOR.Value, "BAC_Labor") + Sum(Fields!BAC_LABOR_OVERHEAD.Value, "BAC_Labor") or could do something like this =ReportItems!Textbox2.Value - ReportItems!Textbox1.Value to reference a cell value. This saves a ton of time, development effort, and reduction of code for calculations, compared to adding together 500 character select statements to make calculations. Also no need to use stored procs and union or join every select statement together with this method.

Trying to count records in SSRS from different data sets

I have an SSRS report that combines 5 reports into one. Each report is populated from a different stored procedure. The first page is a summary that is to provide a record count from each report. I've created fields in the stored procedure that provides the counts for each individual report: phycount and nonphyscount. I'm trying to create a table similar to this:
Active comes from one data set, Initial comes from another, Recert comes from another, etc.
I've been playing around with the Lookup and LookupSet but I'm just getting errors, plus I'm not sure if that's even the right direction.
Does anyone know how to do this?
Lookup and Lookupset are more for getting specific values out of a dataset. Very useful but not necessary for what you're trying to accomplish.
You can use aggregate functions SUM and COUNT to accomplish what you want to do. The cool thing about these functions is you can actually embed IIF statements inside of them.
I'm not sure exactly how your datasets look and are named but it would be something like this...
SUM(IIF(Fields!Type.Value = "PhyCount", 1, 0), "Active")
The sum function goes through every row of your dataset and sums the values you pass to it. The iif statement checks to see if the type field in the dataset is "PhyCount". If so, it returns 1, if not, 0. Since this will happen for every row, your SUM function will return a count of each row with status active.
edit: "Active" after the iif statement specifies the name of the dataset.
EDIT AGAIN: This solution apparently does not work in SSRS 2008.

Dynamic SSRS report

I had a problem in creating the Dynamic report in SSRS. My problem is:
In a table I have stored SQL scripts with the column SQLScripts. If you execute these SQL scripts you get different number of columns for each script.
My problem is, I have one report with buttons of these scripts, for example test1, test2...like that. If you press test1 button this should take the test one SQL script and should display the report with appropiate columns in that sqlscripts.
I can't create individual reports for each test report, they are plenty. Are there any options for me to solve this problem...
The only way I've been able to get this to work sofar is:
Each report has 2 datasets.
ReportData
DataHeaders
The "DataHeaders" need to have the proper name of the datafields in "ReportData". Be careful since SSRS replaces blanks and special characters with "_"
Now, create a table (or matrix) and drag the DataHeaders as the Columns of your report. (This should be a grouped column). If you run it at this point, you'll see all your columns without any data. Now comes the magic:
Create another report that takes a "DataField" parameter. Create another table or matrix within this report and set it's dataset property to be "ReportData". In the DATA cell for the table, set it to the expression =Fields(Parameters!DataField.Value).Value
Now go back to your first report. Right click and insert a subreport. Right click on the subreport and select "Subreport Properties". Under general, select the second report you created to be used as the subreport. Under parameters, select the DataField parameter and set its value to something like =Fields!DataField.Value
In my case I did some formatting in this expression to fix the above mentioned issue with spaces and special characters, since my stored procedure was initially used in ASP.NET and this was just a proof of concept.
Also in my experience the performance isn't great. In fact it was kinda slow, though I haven't had a chance to switch it to use a shared dataset, which I suspect would help a bit. Please let me know if you find a better solution.
I have not found a way to do this completely dynamically. Here is a similar question with some possible solutions:
How do i represent an unknown number of columns in SSRS?
You basically need to create a 'master dataset' from the other Datasets that are based on your multitude of SQL scripts first.The master dataset should contain the data to be presented in it's most simplistic form, i.e. in a simple list format.
Finally, go to the toolbar in SSRS and drag a 'Matrix' into the report. A Matrix table acts similar to a pivot table in Excel or a CrossTab query in Access that will display whatever's in the Dataset.

SSRS Report , Dynamic selection of fields

I want to create a report where my report's fields should change according to my input parameter values.
For example, if I select 2 months, there should be 2 fields in result, having month wise calculation. If I select 3 weeks, there should be 3 fields each for each weeks calculation instead of the 2 months field.
How do I achieve this?
I'm still a beginner at SSRS, but I've heard of a few ways to handle this:
To a certain extent, you're really talking about separate queries, depending on the parameters. So, use a dynamic query (build the query up as a string expression). The simplest way I saw was to use IIF in the expression to choose one or the other stored procedure based on the parameter values.
To the extent that it's pretty much the same query, but you want different columns visible, then you can tie the visibility of the columns to an expression based on the parameter values.
If too much of the structure of the report differs based on the parameters, then you can use multiple reports. Have one front-end report that calls on one of the other reports based on the parameter values, passing the parameter values to the other report.
I hope that helps. If you've already figured out a solution, then please tell me!