How can I get empty columns to appear in SSRS reports? - reporting-services

I have a report that groups hours by the environments in which work was executed. Some customers are in all environments (Beta, PPE, Staging, and Production), whereas other customers are only in a subset of environments. If a customer is only in a subset, then there is no column for environments where no work was executed in that section of the report and as a result, there is white space on the right side of that section for each column that is "missing."
Is there a way for me to force the report to list all environments for all customers, even if there is no data for a given environment/customer combination?
Thanks.

I can think of a couple of options here.
One is to use a table with a set number of columns for all required environments, instead of relying on the required columns being dynamically generated by a matrix type object, and then filling the columns' values with appropriate conditional expressions, e.g. for the PPE column use something like:
=Sum(IIf(Fields!Environment.Value = "PPE", Fields!MyValue.Value, Nothing)
The other option is to change the Dataset to always return a row for each environment, i.e. if you're getting the data from a T-SQL query you'd use something like Environments as the base table and LEFT JOIN it to all the required value data, i.e. always returning each Environment row even if no values exist. This way you could still use a matrix to dynamically generate your columns.

Related

Working with SSRS dynamic fields

SSRS matrix table is a great way to generate dynamic fields as long as values exist.
However, is there a way to "always" show these dynamic fields even if a value doesn't exist for them? The report field locations varies based on data availability and users have to add missing columns in Excel manually.
Dynamic fields go from 3 to up to 30 (at least for now based on run by values). Adding these values manually would make the report hard to maintain.
The way I have handled for this is in the SQL. I build a table of all the values I will always want, I cross join that table to my final output table and update/insert values where they need to exist. That way I guarantee the rows, and eventually columns in the matrix, exists even if they end up being null.
Does that make sense?
Jesse's solution is a good one, but if for whatever reason you can't or prefer not to change the SQL you can do it in SSRS by forcing a blank value in the cell with a expression like this:
=iif(IsNothing(Fields!.xxx.Value)," ",Fields!.xxx.Value)

Yii2 grid data from multiple tables (selecting records of multiple tables)

I have a grid view where I need to show data of more than a table, each record in a row (Not relations).
Thus, a group of grid rows may come from table one, another group of rows from table two, ect...
For example, I need to select from tbl1 rows (suppose r1 to r10), and from table tbl2, rows (suppose r11 to r20) r1 to r10 and r11 to r20 may have a lot of common id's (because from different tables). And I want to show all these records in a single grid view, with search and actions enabled.
I have made an attempt to get data in arrayDataProvider, and it worked perfect.
The problems I am trying to fix are two:
1. Enabling the searchModel in the grid. (For that, I have also get all data in the search model in arrayDataProvider, but still need to enable search).
2. I need to know which record is selected for(view, update, or delete) and take action based on the selection, because the same id may exist in the grid multiple times, each from a table.
To Enable Search:
1. I have used all search models to return arrays based on filtering queries.
2. I have used a basic search model that includes common attributes between all tables, it calls functions from other search models to get array from them, then it concatenates all these arrays and returns them as an array data provider.
3. Needed some attention when dealing with parameters in search models, because they are using the same model as the basic, they have more fields.
When I treat id's and acyions on rows, I will post the method.
If any one having the same issue, and need help, I will be :-)

Add filter option on each column of the data displayed in SSRS

I am generating a table in SSRS based on the selection made by the user on two filters: Filter1 and Filter2 (say). The table so displayed has 10 columns and I wish to add filter option listing all available values for that column for all 10 columns.
Basically, I am trying to replicate the Excel functionality of filtering down data on each and every column.
Please note that I tried creating a new data set and a parameter taking all distinct values for a particular variable. However, I am still not able to get the desired results by filter the tablix on that parameter
Is there a way I can do that?
You'd need to make a new dataset that is a smaller version of your main dataset. It would need to return all potential values for the column(s) you want to filter in a single column to be used in a parameter.
Without seeing the design of the report or the dataset itself it's quite hard to be more specific.

SSRS cascading parameters for SSAS Tabular datasource with M2M relationship between dimensions in SQL Server 2014 BI

I'm trying to build a simple report using SSAS Tabular model as datasource. There are two different dimensions in the model - UserGroups that should be used as first parameter and Regions as second one. These dimensions are M2M-related in the model. Simple measure calculated with the usage of M2M tricks for tabular models works fine in Excel and PBID.
I need those parameters to be cascaded in SSRS report. I.e. Regions dropdown should be filtered after selecting one ore more (Allow multiple values parameter option is ON) values in UserGroups dropdown.
After I put both dimension onto Filter pane in Query Designer I receive two parameters with hidden datasets. Everything looks fine but first parameters (UserGroups) actually do not filter Regions dropdown.
I think I understand the nature of the issue. We see the same picture in other client tools like Excel when placing M2M-related dimensions on the same rows/columns pane - second dimension displays in the Pivot Table all its members until we check a measure in Pivot Table Fields. All the members for the second dimension (Regions in my case) are vanished as soon as a measure comes into play - Excel is smart enough to wipe out dimension members if the measure value is null. But this does not happen in SSRS.
All the "automatic" cascading parameters creation works well within hierarchies of a single dimension. I hope this works as well with one-to-many related dimensions. But how can I extend/modify automagically-created MDX query for the second parameter dataset to be filtered out? It looks like SELECT ( StrToSet ( #[UserGroupsUserGroups], CONSTRAINED ) ) ON COLUMNS is not enough in this case. I need also to check measure value to filter out Regions list. Unfortunately I'm not an MDX expert. Please help me to inject this checking into the query.
You're on the right track and gave a good explanation of the scenario. As you found out, there is no automatic way to make the parameters cascade. You do need to add an MDX filter to the second parameter to make this happen.
As far as the actual query is concerned, there's not quite enough information to give you an exact query. But you would use StrToSet to pass in the first parameter and use the FILTER function to limit the scope. As you stated, including a measure is one way to get only the "NonEmpty" combinations of the two parameters. If you run into a specific problem with a sample query, feel free to provide more details on that.

Cognos Report Studio 10.2 multiple reports from one master

We are needing to build a huge amount of reports, but alot of the metrics and fields are duplicated. Is it possible to build 1 (or a few) report to incorporate everything, and then based on what 'report' is requested to be run by the user, it hides/shows certain fields?
e.g. master report contains columns 1-100
user 1 needs to run report A, which uses columns 1-20, so hides columns 21-100
user 2 needs to run report B, which uses columns 21-40, so hides columns 1-20 and columns 41-100
Any help would be appreciated!!
Yes it's possible.
Go to condition explorer and create a string variable based on
#sq($account.defaultName)#
Create values for all possible usernames.
Use this variable as a Style variable and set up report presentation (show/hide columns) for all values.
And think about using groups not named users with
#CSVIdentityNameList()#
It will be more complicated but you won't stick to chosen usernames.
I would create report views pointing to the single report, one for each version of the report you want to run. Each view would pass in a different static value for a common parameter, say 'reportType'. The report would then use this static value to change the output returned to the user. This can be accomplished with hiding columns as Alexey suggested or you can create multiple pages and use a render variable that tests the value of the 'reportType' parameter and renders the appropriate page. The benefits of this approach as opposed to hiding is easier maintenance and a potential performance improvement as non-displayed columns are not retrieved from the data source, especially if the non-displayed columns force expensive unnecessary joins.