SSRS: Dynamic difference between two columns in MATRIX - reporting-services

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)

Related

SSRS Matrix columns show currrent month

I'm stuck with a problem in SSRS 2012 that maybe is very simple:
I have a matrix with a group row (employee) and a group column (last 12 months); the values are COUNT(practicesDone) - i.e. the amount of practices worked.
I want the matrix to show an extra column on the right (after all the columns of the months, and clearly outside the column group) with again the number of practices for the current month.
Is it possible to achieve that?
thank you in advance!
You can do this, it's pretty simple.
I have assumed that your dataset contains a column that has a date for each entry and that the data returned only covers 12 months so the same month would not appear for different years. If your data does have multiple years, look at the second expression below.
Right-click your month column and then to "Insert Column --> Outside Group - Right"
Now set the expression for the text box to
=COUNT(IIF(MONTH(Fields!myDateColumn.Value) = MONTH(TODAY()), 1, Nothing))
You could swap COUNT for SUM and it should do the same thing but either will work.
All we are doing here is comparing the all data in scope which, due to the placement of the text box means the scope is the entire rowgroup. Then for all that data, check if the month matches the current month, if it does set it to 1 is not set it to nothing then count/sum all results. Count conveniently ignores 'nothing'.
If you data covers more than 12 months then you can still do this but you'll have to add a bit more to handle years and months like this.
=COUNT(
IIF(
MONTH(Fields!myDateColumn.Value) = MONTH(TODAY())
AND YEAR(Fields!myDateColumn.Value) = YEAR(TODAY()),
1,
Nothing
)
)

SSRS How to get the value before the latest column of a matrix row group?

I would like to retrieve the value before the last column in the matrix.
The column are grouped by Month and user can choose in the report one , two, three or more columns , the aim is to get the before last column value.
For getting the last value I just have to do : LAST(filed!Value), how to get the value of the columns before the column containing LAST(filed!Value).
eg: If user choose january to december --> i want to get November value
If He choose January to march --> I want to get February value
I am working with ssrs 2008.
I hope my explanations are clear.
Thanks in advance for your help
LAST(Fields!ColumnN.Value) --> last column
??? --> Before the last column
I haven't tested this, but there is also a Previous function in SSRS that should be just what you're looking for. I don't know for sure if you can use these functions in conjunction, but I believe you could use the following expression:
= Previous(Last(Fields!ColumnN.Value))

How to calculate the percentage of two dynamic columns values in Report Builder?

I have two columns 2016 and 2015 representing the years from the Year column. Each of these years has values for example:
The columns(2016 , 2015) are generated dynamically. I want to calculate the percentage by taking value of 2016 and dividing it through the value of 2015. Now the question is, how can I get to the values? I tried to do it through this expression, but It is not working properly.
Expression :
=IIF(Fields!Year.Value="2016",Fields!Amount.Value,0)/
IIF(Fields!Year.Value="2015",Fields!Amount.Value,0)
Try this:
=SUM(IIF(Fields!Year.Value=2016,Fields!Amount.Value,0))/
SUM(IIF(Fields!Year.Value=2015,Fields!Amount.Value,0))
UPDATE:
I've created a matrix to show you the required setup.
Note Prozent is outside the Year column group. It produces:
Let me know if this helps.

how use average function based in two differents dataset fields ssrs if one depend from the other one

im working with report that visual studio 2010 have, then i have a chart series with four fields planta, date, and densidad, i have to get the average of all the data that densidad has but only when the date is the same for example
Date Densidad
11/05/2015 2
11/05/2015 3
12/05/2015 4
in this case i have two data from 11/05/2015 the only for that date i must get the average that in this case should be 2,5 , ive been looking for an expression that works but i ve found anything, please?
Add a new row group, then go to the group's properties and group by date. In your tablix, add in AVG(Yourdataset!Yourvalue.Value) next to the date. This should group by date.
Your group expression should look like this:
=FormatDateTime(Fields!dates.Value, DateFormat.ShortDate)

MS Access: Referring to a dynamic column name?

Two of the columns in Query A are labeled 2012 and 2011.
However, next year, the columns will be 2013 and 2012. This is because those columns are part of a crosstab where the name is done via the year() function.
Anyway, I am using a new query to add a column that subtracts the values in the two year columns, but I don't know how to refer to those columns dynamically.
e.g. I could easily add a column
Difference: [2012 Revenue] - [2011 Revenue]
But this would stop working next year.
Why don't you label them these columns to something a little more generic and use them like this
Difference:[This Year] - [Last Year]
Building on HelloW excellent suggestion, you could use as the Column Header of your Crosstab an expression like "RevYr" & (Year(Date())-Year(RevenueDate), which would evaluate to
RevYr0, RevYr1, RevYr2, etc...
Your difference would then become
Difference: RevYr0 - RevYr1
Edit:
Facing a similar problem using a crosstab, I found these 2 very interesting links:
http://allenbrowne.com/ser-67.html
http://www.access.hookom.net/DynamicMthlyCrosstabRpt.htm