Display the difference between 2 columns where multiple columns associated from dynamic matrix in ssrs 2008 r2 - reporting-services

enter image description hereI have to show the data in the report just like above .. i need to get the difference of Medicaid 2017 value and Medicaid 2016 in Med diffrence
commercial 2017 value and commercial 2016 in commercial difference column... note that 2016 & 2017 are dynamic values as year changes these will change..any pointers would really help? please see the attached images data & matrix
Appreciate your response.
Thank you!!!! enter image description here

Each row is going to be grouped by the salesperson so the only thing we need to detect for our calculation is the year.
=SUM(IIF(Fields!Year.Value = "2016"), Fields!Medicaid.Value, 0)) - SUM(IIF(Fields!Year.Value = "2017"), Fields!Medicaid.Value, 0))
What this does is run the sum function through the dataset (with group filter). In sum we can nest the IIF logic to detect what the year field is in the dataset. If it is the year we are looking for, we return the value of the data (in this case the medicaid value). The end result is the sum of all values matching the date. Then we subtract that by the next year and there is your difference.
I know you want to keep this dynamic. You'll have to test your own solutions since I'm not sure how you will handle this in your data. Assuming at the very next year this will flip to current year and previous year, instead of hard coded year you would use:
Now().Year and Now().addYears(-1).Year
I think all this code should work but I did not test. You might have to confirm those VBNet DateTime functions. Just tried to get you an answer on my lunch break!

Related

How to define Row Data group in SSRS if we have two parameters to be considered?

Im new to SSRS reporting. Im trying to edit in *.rdl file, where it has row data grouping to view data for a month.
eg: =Fields!EndOfMonth.Value
Here EndofMonth will return September 30th /October 31st etc. So table is grouped by one month data.
I need to edit this for a custom data range.
eg: startdate='2019-09-05', enddate='2019-10-12'
So, report table should display rows between September 5th to October 12th.
I have both startdate enddate parameters defined in the *.rdl file.
But I dont know, how i can switch between both date ranges based on condition. that is , if companyid<>50 pick custom range else standard.
eg:
I defined like this, but here i could point only one parameter(i used enddate only).So report shows rows between October 1st to 12th only.
How can I modify the condition?
=IIF(Parameters!CompanyId.Value<>50,Fields!EndofMonth.Value, Parameters!EndDate.Value)
EDIT
I have 2 datasets defined to switch between companyids.
I modified above condition based on Nicks answer, but i get lookup function can not be used with functions issue.
I tried following both way, but getting same rows again and again
=IIF(Parameters!CompanyId.Value<>50,Fields!EndofMonth.Value,
IIF(Lookup(Fields!TankDateCombo.Value, Fields!TankDateCombo.Value,Fields!Date.Value,"Dataset2")
>= Parameters!StartDate.Value,Fields!EndofMonth.Value,
Parameters!EndDate.Value))
=IIF(Parameters!CompanyId.Value<>67,Fields!EOM.Value,
IIF(Day(Lookup(Fields!TankDateCombo.Value, Fields!TankDateCombo.Value,Fields!Date.Value,"OESNeoData"))
>= Day(Parameters!StartDate.Value), Fields!EOM.Value,
Parameters!EndDate.Value))
MY dataset contains following data;
I fixed this by simply deleting that row group and passing start/end dates for both datasets

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)

Need Savings totals by month to pull data correctly and display in Chart

My data and this SSRS chart have a ton of problems, I'll try to keep my question(s) succinct.
First, as you can see by this chart and this screenshot of my data (just showing date and April Savings), my expression/chart is not summing all of the savings within a month, which is my goal.
It appears to be picking one amount within the correct month and using it. I set up a tool tip for April so I could see what number it's pulling (since clearly the chart columns are not representing the data whatsoever - another issue).
You'll see in the SQL data screenshot that it does indeed pull $1,230 from the April 2013 Savings. How can I get this to Sum within the month AND still do a running value from the beginning of time data began to current, this often will include multiple years.
Here's my Chart Data (note that my Team Goal works perfectly, and is even charted correctly - but if anyone knows how to force that line to go from end to end on my chart, feel free to let me know.) :
To summarize, how can I sum each month's data, while still do a running value across the months AND years?
Here's my Expression for Implementable Savings:
=RunningValue(Sum(Fields!ImplementableSavings.Value), Sum, nothing)
(obviously if I can get one working, I can get both)
My Expression for ImplementedSavingsMonth:
=MonthName(Month(Fields!ImplementedSavingsDate.Value))
My Expression for ImplementedSavingsYear:
=Year(Fields!ImplementedSavingsDate.Value)
Let me know if there's anything else I can provide.
Quick sidebar question: WHY does my chart column collect one piece of data. IE: see the tool tip $1,230 for April 2013), but the chart column displays that the number is around $1.7M? And in this scenario, both of my blue and yellow columns are displaying the same number, so why does blue always appear to be a higher number? I will ask this as a 2nd question if it's inappropriate for me to ask here.
I would use this Expression for Implementable Savings:
= RunningValue ( Fields!ImplementableSavings.Value, Sum, "Chart1")
.. assuming your Chart's name is Chart1.

SSRS - creating chart - overlapping year - end of year/start of next

I have to report on some data covering November, December of 2013 and Jan, Feb of 2014. I know how to chart over a calendar year but I'm struggling with this...any one know how i can chart this in nov,dec,jan,feb order???
cheers
You have to have some field available in your dataset or a calculation based upon a field/fields that orders them correctly. If you have something like yyyy-mm (ex: 2013-11) you can set the sort order of the category group within your chart. Leave the actual value as you want it to be seen, just change the sort order.
Here's a good blog post that (I think) explains exactly what you are trying to do: http://www.allaboutmssql.com/2013/06/ssrs-in-charts-how-to-sort-labels-on-x.html
Sort the data first by =Year(Fields!YourDateField.Value) and then by =Month(Fields!YourDateField.Value)
Thanks for the input... i found this Custom ordering of series field for stacked chart in SSRS08 TFS
so i manually changed the value value with a switch and then ordered A-Z
All good now
cheers

How to hide grand total from chart (ssrs over olap)

I have a report in ssrs 2008, its data source is based on ssas.
I created a pie chart which shows total cost per shape. Dataset of the pie consists of only 4 fields.
Say i have 2 shapes, each of them has total cost. But in addition to that i also get a third slice in the pie which shows total of the other two.
How do i get rid of it?
Ok i figured it out luckily.
The problem was that my dataset returned the total, so i just filtered it in dataset filter expression.
I'm pretty sure there is a way not to return total inside dataset in the first place, if anyone knows, i will be glad to learn
In your dataset you want to change the expression to [Dimension].[Hierarchy].[Attribute].members or [Dimension].[Hierarchy].children. If you do [Dimension].[Hierarchy].members you will get the All member included.
Example: [Date].[Month].members will return each month plus the all member. [Date].[Month].[Month].members will return the members without the All member.