add variable number of empty columns to a tablix - reporting-services

I have a tablix with a column group so that it will create a column for that field provided any row has data for that column.
I need to create a version of this report that contains some empty columns on the end.
I want the number of columns to be added to be based on some factor of the non empty columns with some min/max constraints also. (my question is not how to get the number of columns required)
so far i've tried.
1 - adding individual empty columns to the tablix and setting the visibility condition on each column.
a bit long winded and a bit of a faff.
2 - creating another column group and grouping on the same field, this creates
cant vary the number of columns returned.
am i missing a simple way of adding x empty rows or columns to a tablix? where x can be calculated somehow from the values in the dataset.

You will have to fib this scenario in your data. The column-wise grouping works with known data including those falling in the column group value with null values. There is no way to grow your groups without data unless you add some column group footer logic that would be pretty weird.
I would look into producing phantom NULL value records that will push out your columns.

Related

SSRS column group displays data on unique rows

I have a data set where i'm using a table to display Name, Radio #, and Unit # information in SSRS tablix. As some of the groups have 60+ members, i thought it would be better to expand the tables into 4 columns repeating those detail fields instead of displaying a 3 page long skinny table. In the SQL i used a row count%4 function to assign a "position" number 0-3 for each name. If i create a table with the detail members above and then add a parent column group on position, i get the tables repeated as i want but each name/radio/unit appears on a unique row. I've tried several different ways of grouping rows/columns but always seem to get this staggered table (with only name/radio to make it easier to digest): sample_pic
Sorry if this is a duplicate. I've really searched quite a bit before putting this in but it's probably the case that if i knew what to search, i wouldn't be putting this question in. So if you'd rather tell me what to search i can do that too. :)
SSRS will display a row in the table for each row returned from the dataset, this is normal behaviour for data to display.
One way to get what you want is to create a query which has all the information form your column headings in one row, probably with a pivot or similar.
Or you could just display your columns in separate tables.

Grouping with if condition

I've got a table with a number of rows. Let's say it has 2 columns called Value and Value Type. I've got a group on Value Type
Outside the group, I've got 2 rows. 1 for each value type (There's only 2 value types). I want to sum the values for each value type, but the issue appears that I can't reference more than one column.
So I can't do something like this as it's referencing two fields.
=SUM(IIF(Fields!ValueType.Value="Blah",Fields!Value.Value,0))
How do I get around this?
I figured it out. I just needed to use the phase Nothing, rather than 0.

SSRS - Why is my table duplicating rows?

I am creating a report in SSRS. I have a table showing the date and time the report was generated, it's a single column table with one expression =Now() and is not linked to any datasets.
The trouble I am having is that it returns 77 rows all with the exact same date. My main dataset returns 77 rows in a different table but that table is not linked to this one in any way.
How can I stop it from returning so many rows? The reason I'm using a table and not a text box is because I want it to have the same look and feel as other data presented in my report i.e. Header Row and Data Presented underneath. There are a few tables that use the same approach and all of them are returning duplicate rows. As you can see from the image below, I just need the first row from each table.
EDIT: Looks like SSRS automatically references a dataset when I insert a new table. When I change the table properties dataset to none it returns an error. Is there a way around this? I don't want data from any dataset, just want to use an simple expression =now()
As you've seen, a Tablix requires a DataSet, and when you only have one DataSet in a report it will link to this DataSet automatically in some circumstances.
You've mentioned you don't want to use Textboxes, but this does seem like the easiest option.
If you're set on using a Tablix for ease of formatting, to prevent any repeating rows just delete the Details group that gets set up by default when you create a Table through the designer:
This leaves a table with one header row only - you can add more header rows as required:
The result is a table that will only display the header rows once, i.e. no repeating rows.
You can add Summary data or individual fields from the DataSet to these header rows; if no aggregation is specified it will just take the first row by default.

Interactive sorting in tablix with column and row groupings

I'm trying to define interactive sorting in a tablix. The sorting should affect the row order.
Attaching image of the tablix in order to explain what I'm trying to get:
I already tried to define the column header with interactive sorting and get SubjectParentID to be sorted by expression (the same expression as described bellow). The final setting I made is to apply the sorting to all groups in the tablix -
Attaching image:
The result wasn't current and the data got messed up in the cells.
Additional information: The columns are grouped by SubjectParentID. The rows are grouped by Username as parent and UserID as a child group.
The values are result of the following expression :
=iif(isNothing(Fields!ResReqCertID1.Value),
-99,
Sum(iif(Fields!CertStatusID.Value = 3
Or Fields!CertStatusID.Value = 4
Or Fields!CertStatusID.Value = 5,
1,
0)) - Fields!ResReqCertID1.Value)
In the Text Box Properties / Interactive Sorting window, change the Groups selection to the UserID group (assuming that is the most-detailed group providing the rows in your example).
This can't be done, interactive sorting cannot sort row groups by column values calculated within that group.
If you have 4 static columns you could hard code them. Then having no need for column groups interactive sorting should work as expected.
You could also define a static number, say 10, of dynamic columns, and use pivoting in the thebsql query to get columns 1-10 and their labels. Then set up 10 columns with interactive sorting on the Value_1 fields, and hide them if no data exist for that column. You could then also have an 11th column which also does column grouping but doesn't do sort if there's any chance you'll ever exc3ed the 10 columns.
You could also do this: https://www.c-sharpcorner.com/article/ssrs-interactive-sorting-on-matrix-column-group/ which is somehow even more complicated than my two solutions.
But yeah, you basically can't do this. SSRS cannot be told to sort row groups on values calculated from within the context of the column group that contained the copy of text box in which the sort button was clicked.

Exclude hidden table row from total

I've created a table with a group filter so some values stay hidden.
However, the row that shows the sum() of the above values, still counts the filtered values.
Usually I would apply the filter to the query, but I'm also using this same dataset in other tables on the same report so that's not an option.
Am I missing something here, or is this a flaw in MS Reporting Services?
This appears to be a "feature" of SSRS, apparently because it calculates values in table headers and footers before rendering the detail section of a data table.
One way around this would be to add a derived Boolean column to your dataset (assuming your data source is SQL Server, using a CASE statement or similar) showing whether the row should be excluded from the table where the filter is required.
You can then change your table filter to check the indicator, and use a expression to carry out a conditional sum to aggregate the correct total. Something like
=SUM(Iif(Fields!ExcludeRow.Value = True,0,Fields!ValueToSum.Value))
It's more of a question than answer...
How to resolve this issue if you know whether the row is hidden or not ONLY at the Row Group level?
i.e. if you're filtering on the totals by this Row Group, i.e. you cannot have a field indicating if Row is excluded or not in a dataset.
ex: I have AR Aging report which has totals per months, patients. I need to filter out negative totals per patients (Patient row group), but I have column groups as well - per month, so my dataset cannot be per-patient granularity and therefore, the only place SSRS can decide whether to hide or show the row is on the Row Group level...
I had the same issue but I had too many column totals where to enter the Iif().
I resolved it by removing the filter from the group and putting the filter into the Tablix Properties dialog box (Select Tablix, Right-click the top left corner grey box and choose Tablixc Properties).