SSRS semi additive function for tablix cells - reporting-services

I have to produce a report where in my row values should sum up on collapse (summary data) but column values should not sum up on collapse, rather show the last value. Here is a sample report
Fully expanded report
-2012
Jan Feb Mar
-India Chennai 10 8 9
Bangalore 15 15 16
Rows collapsed
-2012
Jan Feb Mar
+India 25 23 25
Columns collapsed:
+2012
+India 73
However, I don't need summarized data as sum for column collapse. The right data would be the last one available in the month data, which will be
Columns collapsed:
+2012
+India 25
I don't find any semi additive function available to be used in the report's tablix cells. Either i can use sum or last which applies to both rows and columns summary, which i don't want.
We don't have a problem with this in pivot table as we have defined the measure as a semi-additive measure on time dimension. The only problem is with the report designed using SSRS. Any idea on how this can be achieved?

It sounds like you are using a cube as your data source? If that's the case, don't use the SUM function in SSRS for the expression in the textbox. Instead, use the AGGREGATE function. That tells SSRS to get the value from the cube. If it's defined correctly in the cube (as shown by your pivot table) then you should get that same value in your report.

Related

How to get sum of last 6 months depending on a parameter?

i'm currently working on a ssrs report. The report contains 4 parameters, only two are relevant to the question: no. 3 and no. 4. The label of parameter no. 3 are "12 periods" up to "24 periods", but the values are 12 up to 24 as integer.
This is what the report looks like:
enter image description here
For example if i choose the value "13 periods" (or higher) for parameter no. 3, the query retrieves data for 13 periods (or higher) startet with the last month depending on parameter no. 4. So the data are included the report. Now the column "Sum Consumtion" should be only store the Sum of the last 12 periods regardless of the parameter value no. 3 not 13 periods (or higher). So the Result is 67 not 77.
Any idea how can i do this?
Thx for your support...
You can do this by using a calculated field.
Add a calculated field to your dataset. The expression would filter it to the past 12 months. So it would be something like this:
=IIf(Fields!DateColumn.Value >= DateAdd(DateInterval.Months, -12, Parameters!EndDate.Value), Fields!ColumnToSum.Value, Nothing)
Now you can reference this new field in the total column. You would simply Sum it.
Depending on your date formats, you'll probably need to adjust the date comparison logic to meet your needs. If you don't have the End Date available in the report, add that first. It can be in the query or another calculated field in the report. But the idea is that you are getting a conditional sum.

SSRS: Dynamic difference between two columns in MATRIX

I try to create (in SSRS) a summary of incomes in years and I'm stuck when I try to compare them.
e.g. of my table, where Rok = Years:
I have table like at image above where A and B are Expressions (sums of incomes). Columns are years from the SQL query, So 2020 will appear soon. I would like to divide 2019 vs 2018 but dynamically so if 2020 will appear, everything will calculate between 2020 and 2019. Do you know any solution for that ? Thanks in advance :)
First you need to have an individual filtered column group for each year.
Second add in column outside group right, labelled as compare and
Insert the following expression: =ReportItems!Rok.value - ReportItems!Rok1.value ( Rok and Rok1 are the Name available from Text Box Properties for each filtered column group)

How can I add titles to columns in a matrix that are created dynamically in a report?

I have a matrix that creates 3 columns when it's run and I am unable to add a title to those dynamically created columns, as required by the client, and can't find any fixes or examples online. I hoped putting the matrix and textboxes into a table might work, but the same result as the images below occurs.
Is this seemingly simple thing just not possible, or is there a workaround I'm missing?
Design View
Result Textbox displayed after columns
Row and Column Groups visible
If you have 3 MTLH1 value for each NTLH2 value then you can do something like this...
(as you supplied no sample data I generated some from the sample WideWorldImporters database). My Query gives me 5 columns and results similar to the below.
CustomerCategoryName Qtr Mnth MnthName OrderValue
Computer Store 1 1 Jan 10
Computer Store 1 2 Feb 12
Computer Store 1 3 Mar 15
Computer Store 2 4 Apr 20
Corporate 1 1 Jan 11
....
Basically we end up with 3 months per quarter
I then added a matrix control to the report, dragged CustomerCategoryName to the rows, Mnth to the Columns , Qtr above Mnth so it becomes a parent column and finally OrderValue to the data "cell".
I actually swapped the Mnth field out for MnthName in the column header to make it easier to read, but the column order is still sorted by Mnth (the numeric version). I then centered the column headers for readability.
The final design looks like this
If we run the report, the result looks like this..
As you can see we have 4 groups, one for each quarter, each with 3 columns.
If you want to customise the quarter names, you could do that if required by changing the expression in the cell. For example if we wanted all quarters to have "Q" preceeding the number except the 2nd Quarter whcih we want to have a specific string then you could use something like.
=IIF(
Fields!Qtr.Value = 2,
"Second Quarter",
"Q" + Cstr(Fields!Qtr.Value)
)
The final output now looks like this...
Alternatively, you could generate all the column headers in t-sql so where I have MnthName you could create a Quartername or similar.
Hopefully this is useful. If not, please post sample data and expected results of that sample data and I'll revise the answer.

Chart Percentage Differences in Reporting Services

How can I chart year on year percentage change in a reporting services chart?
From my source data (which is a SharePoint 2010 list) I can use the "Previous" function in a table to work out the percentage change over time in years. I have row groups (the years shown below) and column groups (A, B and C).
A | B | C
-----------------
2010
2011 3% 4% 5%
2012 2% 3% 1%
The formula in the table is (year 2 rate - year 1 rate)/year 1 rate. The first row is blank because I have an iff function checking if there is a previous row, and to show nothing if that is the case. Otherwise it does the calculation.
I cannot use the previous function in a chart. How can I graph this? If this was a normal database I would look to doing something at that level and present the to reporting services, but with a SharePoint list I can not and have to do the grouping and other work in reporting services (2008 R2) itself.
Any ideas? I am open to presenting the data in another way if that can effectively provide some view of how the data has changed over time in a chart.
To extract another years set of use the lookupset function and the sum function e.g.
=sum(fields!number.value) - sum(lookupset(fields!year.value - 1, fields!year.value, fields!number.value, "dataset")
Further reading http://msdn.microsoft.com/en-us/library/ee240819.aspx
Also the lookupset function returns all matched values and the lookup function returns the first only.

Link Subreport to matrix

I have a matrix like below. years on columns and countries on rows.
Countries 2001 2002
US 100 400
UK 200 290
IR 300 89
I have a requirement of creating a subreport which shows Invoice details. When I click 100 (US-1002) on my main report I have to show all the 100 Invoices. I tried this way:
Since I am doing count for InvoiceID in matrix, I tried using Join(Fields!InvoiceID,", ") expression on the data test box action(Go to report). On the other side I created a subreport with multivalue parameter. But this approach dint work. I found that Join will not work with data rows as it expect arrays.
Later I used Join(LookupSet(1,1,Fields!Name.Value, "DatasetName")," / "). I could join the invoice ids but the problem is , this expression joins all the invoice ID in complete dataset. I just need US-2001 cell (100) invoice ids only to take to my subreport
From your description, it sounds like the easiest thing to do would be to set up the subreport to take two parameters, Country and Year, instead of trying to pass the list of invoices.
The subreport can then report all the invoices for a particular Country and Year combination.
It would be simpler to just set up the drillthrough to accept the two fields for its parameters, as above, instead of try to work out an expression for all the invoices in a particular cell's scope.