Creating column heading that dynamically increases in SSRS report - sql

I have to create a report that looks like below. All the months are dynamically called through Matrix report. And i am not able to place the heading "Yearly Counts" that also dynamically varies with no of months.
Could you please help me in doing this.

If I understand you correctly, you are able to get the Matrix to dynamically add 1 column per month, but you can't get the "Yearly Counts" cell to work correctly, right?
If you use the following option (right-click on the box to the left of the Month row to get to this menu), you should be able to add a header row above the month headers that will expand to cover as many month columns that dynamically appear:
The Matrix should end up looking like this (in design mode):

Related

PowerBI Dynamic Time Series BarChart

Adding on my previous question here: TimeSeries question
I would like to plot a unit capacity chart over a Time series (which contains a range of dates set by the user).
The chart I am trying to plot is as follows:
For each Unit Name, I have start and end date for the unit capacities, as shown in the PowerBI table as below:
4 sub questions:
How to plot these capacities over time? Maybe using some DAX functions?
Do i need the SSAS cube to solve this problem or can I do all the work inside PowerBI desktop? If not, is there a better way for example in SSRS?
Is there a way to make the x-axis time series dynamic as specified by the user?
Adding to this, after Leonard's response. After converting the OutageStartDateOrig, and OutageEndDateOrig values I tried to create the calculated column as suggested in the youtube link {enter link description here}. However, the DAX formula as shown in the video gives out a syntax error for me stating that the '.' is incorrect when specifying the range of dates. Any ideas for this? [Screenshot below]:
To create such a visual, I'd recommend an area chart (or stacked area chart) with the date on the axis, the unit name on the legend, and the capacity on the values. You could also do it as a stacked column chart too. However, then each date will be broken into discrete columns. See below image.
In terms of data manipulation, you'll need to convert the data with the date ranges you have above into a row for each individual date & unit. E.g. the first row, instead of being 11/2 to 13/2, would be expanded into 3 rows, one for each date.
You can do this in Power Query as you bring the data into Power BI Desktop, or in DAX after bringing it in. There are several solutions to this outlined in this thread (https://community.powerbi.com/t5/Desktop/Convert-date-ranges-into-list-of-dates/td-p/129418), but personally, I recommend the technique (and video) posted by MarcelBeug (https://youtu.be/QSXzhb-EwHM).
You'll also want an independent list of dates (with no gaps) to join the final date column to - otherwise your visual will skip dates when no units had capacity. By default, the chart will begin on the first date with data and end on the last date with data, so in that sense it is dynamic, but you can add a date slicer to give the end-user more control.
Area chart on top, column chart on bottom, date slicer on right filtering Jan-Mar.

SSRS Dynamic Graphs

Does anyone know if it is possible to create a graph(s) at run time based on the dataset?
To clarify, I have a count of patients suffering from a health condition, split by week. I need to make a graph per condition with weeks on the X axis and patient count on the Y. Nice and easy so far.
The problem is that the number of conditions displayed in the dataset will be different depending on the values entered for the start and end dates for the reporting date range.
With this in mind can I create a single graph then tell it to replicate once for each condition returned and only look at the data for that specific condition?
The graphs can't appear in rows as they must aggregate data from multiple rows (where the condition is the same) and plot the various count values over week numbers (the dataset returns a count, a week number and a condition with a group by on the week number and condition)
As an added challenge none of this can be hard coded as the single report has to work across multiple sites.
Thanks
P
Yes this is possible by first dropping a "Matrix" control into the report surface. With the Matrix control, you're able to display groups of data. In this case, your group will be the condition returned in your DataSet. Each group will have an embedded chart which will display data the same way, but only the data within the grouping you choose.
Step 1: Add a Matrix control to your report surface. Create a Row Group based on Condition (In my example, Year)
Step 2: Right Click the empty column on the right side of the Matrix control, and choose the option for Insert Column > Outside Group - Right. Then Delete the middle column.
Step 3: Right click the Right columns "Data" cell (which should be outside the grouping) and choose Insert > Chart. Select the desired chart type.
Step 4: Resize the column and row to view the chart in more detail. Edit the Chart Data to aggregate what you're wanting to show as the line, and pick your category groups.
Step 5: Test, and revist whichever step above needs adjusting.

SSRS Matrix Report : Colors condition

I have a matrix table created with Rows as Days ,Columns as Months and quantity of rainfall as the data field(got all this information from same table 'Rainfall'). I have taken this data from a dataset containing multiple tables in SQL. All of this information displays properly.
Now I have many tables with date field in my dataset in tables other than 'Rainfall'.
In the data field of the matix I need to be able to add my own colors using a Switch case.
The Condition I need is "if a certain date from one table matches the date in my report then i want xxx colour."
eg: there is a table called fertilization which has 3 dates. Now if these 3 dates also exists in my matrix then that block should be colored blue.
Can anyone help me. Thanks!
You can also manage it from sql side while retrieving data from Rainfall table.
You can do this using by right clicking the field that you want the dynamic color on and selecting properties. Select Border and then where it says color hit, click the Fx button. Here you can write a custom expression that will change the background color based upon your code.

SSRS MAtrix/Tablix

I have a report in SSRS report builder 2008 that has a chart that is a definitive size. I would like to make the matrix table fit neatly under the report as it would in excel. However it expands way past the report. I have tried turning can grow can shrink to false did not work. I have tried putting a rectangle and placing the matrix in there with no success. I tried setting the size in the tablix properties but it extends or shrinks below based on the data in the tablix. The tablix is just 6 lines the top line is a expression for the date and then there is previous year previous cumulative current yeat and current year cumulative and receipts %to last year. i have included the expresssions I used in the tablix not that I think it is causing the issue Any help will be greatly appreciated
=Sum(Fields!ID2013_Inventory.Value)
=Sum(Fields!ID2013_Inventory.Value)
=RunningValue(Fields!ID2014_Inventory.Value,Sum,"RECEIPTS_IND_DEC")
=SUM(Fields!ID2014_Inventory.Value)/SUM(Fields!ID2013_Inventory.Value)
Sorry I didn't follow up your comment earlier, it's been busy here...
There is a sledgehammer approach to this that will work, not sure if there is a more elegant way but here goes.
Fist some basics...
Determine how wide your matrix needs to be, let's say 25cm
Let's assume you have a couple of columns on the left that are both fixed at 2cm each. That gives us 21cm to put our varying columns in.
For now assume we only have 28 days, so we need to set the column width of the column group to 0.75cm (21/28).
Test and make sure everything looks OK.
Now here's comes that sledgehammer!
Make another 3 copies of your matrix and adjust the column widths for the next three number of days (so 29,30 & 31).
Now set the visibility of the of each matrix so that it only shows when the related number of days are returned in the dataset.
I don't know what your dataset looks like so I can't give much advice on determining the number of days returned but I often create another dataset that gets the value, in your case something like
SELECT COUNT(DISTINCT MyDateColum) as DateCount FROM MyDates
Or I guess you could probably base visibility on the month and whether its a leap year or not.
Hope that helps, if any of it is unclear let me know and I'll try to get back a little quicker this time.

Group and subtotal columns in Reporting Services 2005

I have a report (RS2005, against a MSSS2005 instance) which I have inherited. It shows a basic table of data: a handful of key fields which are used to group rows together, a few basic numeric fields, then a number of dated ('bucketed') fields (e.g. 1 month away, 2 months, 6 months, a year, 2 years, etc.)
The user would like to group together these dated fields in aggregated groups and be able to collapse or expand the columns as you can the rows. So we'd be able to show the next year's values' subtotal or expand it to break it out by month. Hiding the invidual months if the subtotal is shown.
This is basic pivot table behaviour (and can be done with the Group/Subtotal feature on Excel - that's the closest analogous behaviour I could use to describe the requirements).
While grouping by rows seems trivial in RptgSvcs, grouping columns and collapsing a group into a single subtotal and blowing it out again, seems hard to impossible.
Unless someone knows better?
You should be able to do this by selecting the columns that you would like to hide and set their visibliity to be hidden.
Then set the toggle item on the hidden columns to be the textbox that shows the subtotal.
This textbox will then have the [+] symbol on it, and clicking will show/hide the your month-by-month breakout(the hidden columns).
On the right hand side of the table control on your report (RDL file), you should see icons representing the detail and grouping information for the table.
Here you can see whether or not a grouping has a header/footer and how it is calculated e.g. =SUM(fields!mySalesValue)
You can also set things like whether it is collapsed and so on