SSRS Charts data - reporting-services

I have situation where I need to create a column chart.
I have a field NotificationLog.Duedate . With this due date I need to create a chart with various condition.
I need to calculate the count of rows with conditions like below
NotificationLog.Duedate < Present date
NotificationLog.Duedate > Present date & NotificationLog.DueDate-Present date < 8 days
NotificationLog.Duedate > Present date & NotificationLog.DueDate-Present date > 8 days
Using the above counts I need to create a column Chart which with the three categories in X axis and Days marked in Y axis.
As of now I get the NotificatonLog.Duedate in a dataset with several other columns . How Can i proceed from this point and accomplish my requirement .
Thanks !

You need to set up an approriate expression-based field to group on.
I have a simplified Dataset to replicate your issue:
I have added a Calculated Field to the Dataset, called DuedateGroup:
The expression is:
=Switch(Fields!Duedate.Value < Today(), "Overdue"
, Fields!Duedate.Value > Today() and Fields!Duedate.Value < DateAdd(DateInterval.Day, 8, Today()), "Near Due"
, Fields!Duedate.Value > Today() and Fields!Duedate.Value > DateAdd(DateInterval.Day, 8, Today()), "Far Due")
i.e. the three groupings you require.
Now you can just use the new field in the Chart:
Looks OK to me.
If you didn't want to set up a Calculated Field, you could add the group expression directly into the Category Group at the Chart level, but I like the Calculated Field option.

Related

SSRS - Report Builder: Show Items from groups in a column chart using tooltip

I think that it might be easy, but I cant figure out how to make it work.
I have a column chart with tickets grouped by time (rounded to 15 minutes)
X Axis - Time Group (Rounded to 15 minutes)
Y Axis - Count(Tickets)
I'd like to show "ticket number" and "title" of all grouped tickets in one column as a tooltip
I have already tried lookup / lookupset / miltiplelookup - it didn't work. I have also tried to join the filed -> =Join(Fields!IB.Value, ", "). That didn't work either. Im just getting #error by hovering over my column. If i'm just displaying the field, i'm getting only one value =Fields!IB.Value.
Any thoughts?
p.s. im Using Report-Builder and Ssrs2016
This how it may look like:
As i mentioned earlier, I have used some rounding function to group Tickets by the time Column. This is the code:
=Mid(Fields!time.Value,1,3) & Replace( Mid(Fields!time.Value,4,5),
Mid(Fields!time.Value,4,5),
Switch(
Cint(Mid(Fields!time.Value,4,5)) >= 00 And Cint(Mid(Fields!time.Value,4,5)) <= 14, "00" ,
Cint(Mid(Fields!time.Value,4,5)) >= 15 And Cint(Mid(Fields!time.Value,4,5)) <= 29, "15" ,
Cint(Mid(Fields!time.Value,4,5)) >= 30 And Cint(Mid(Fields!time.Value,4,5)) <= 44, "30" ,
Cint(Mid(Fields!time.Value,4,5)) >= 45 And Cint(Mid(Fields!time.Value,4,5)) <= 59, "45" ))
As you probably guessed, your lookupset() will not work as it's compares 1 to 1 and therefore returns all values.
Assuming your time group column is called TimeGroup and your ticket number and title columns are called 'TicketID' and 'TicketTitle' then..
You need to change the lookupset to something like
=JOIN(
LOOKUPSET(
Fields!TimeGroup.Value,
Fields!TimeGroup.Value,
CSTR(Fields!TicketID.Value) & ": " & Fields!TicketTitle.Value,
"DataSet1"),
"," + vbcrlf
)
Time group will always be evaluated in the context of the tooltip, so if you hover over time group A, time group will be evaluated as A and therefore the lookupset will only return values matching A.
The return part of the expression converts the ticket number to a string, adds a colon and then appends the title.
We wrap the whole thing in a JOIN() to combine the results of the LOOKUPSET array into a single string using , and carriage return /line feed between each instance so that the resultS show 1 per line.
I have solved this problem with the function from #Alan Schofield using TimeGroup, but for that I hade to redefine my group settings:
Add custom field to my DataSet with the group function I mentioned in my question
Group my ColumnChart by this field
Use count(Fields!TimeGroup.Value) for the Y-Axis (instead of count(Fields!TicketID.Value))
Join the Group from the Chart with the Group in DataSet and listing all results in the tooltip
P.S. I hate this solution, but it works well

SSRS Sum Values Based on Earliest Date

I'm trying to sum a net balance based on the earliest date in an SSRS report. In this case there are only 2 dates, but there can be more dates not more than 7 days.
Here's a sample of my data:
Here's what I'm trying to get with the earliest date of 10/26/15:
I've tried the following code, but not able to get this to work:
=Sum(IIf(DateDiff("d",Fields!SettleFullDate.Value,today())>=7
and DateDiff("d", Fields!SettleFullDate.Value, today())<7
and Fields!SETTLEBALANCE.Value>0), Fields!SETTLEBALANCE.Value, 0)
Update: I tried the code below and keep getting an error on the report. Could it be that I need to change the date field to an integer?
Thanks in advance for your help!
To compare the sum of values of two dates, the maximum and minimum in a set you can use the following equation
=Sum(iif(Fields!myDate.Value = Max(Fields!myDate.Value), Fields!myVal.Value, 0))
-Sum(iif(Fields!myDate.Value = MIN(Fields!myDate.Value), Fields!myVal.Value, 0))
This Sums all the values that match the maximum date in the dataset together, and sums all the values that match the minimum date in the dataset together, and takes one from the other.
It is irrespective of which dates you ask to be received, the above approach will work only against the records that you return to SSRS. So if you have a filter (WHERE clause) to return records between Date1 and Date2 this will still apply (Note - don't actually use 'Between' in the query)
Rather than using the maximum and minimum dates as listed here, you could also calculate a date similar to your original approach using
dateadd("d", -7, Fields!MySpecificDate.Value)
And insert that to the expression above.
Hopefully this is what you require - if not please let me know.

Finding difference at group level

I have 3 months of AR data. From SQL I am populating details records for 3 months. In SSRS I am grouping the totals by month and showing only group summary. I want to calculate the variance by difference between current month and previous month. Please see the attached output file.
Could anyone help me on finding the variance at group level. How do I calculate the difference by using previous function?
Is there any way to find individual group sum of the particular field like this one
Sum(Fields!Current.Value, "DataSet1")
Something like this perhaps?
=Sum(iif(month(Fields!myDate.Value) = month(Max(Fields!myDate.Value)), Fields!myVal.Value, 0))
-Sum(iif(month(Fields!myDate.Value) = month(dateadd("M", -1, max(Fields!myDate.Value))), Fields!myVal.Value, 0))
Where myDate is the date used to group the months on, and myVal is the specific data for the column
UPDATE
Using this dataset
EOM myValue
09/30/2015 2
10/31/2015 6
11/30/2015 19
Gives this basic report
You can then use this formula (based on the original one in the original answer above) to determine the difference between the last and the penultimate row
=Sum(
iif(month(CDate(Fields!EOM.Value)) = month(Max(Fields!EOM.Value)),
Fields!myValue.Value,
0)
)
-Sum(iif(month(CDate(Fields!EOM.Value)) = month(dateadd("M", -1, max(CDate(Fields!EOM.Value)))),
Fields!myValue.Value,
0)
)
Then place this in the footer of the tablix as shown
This shows the difference between the two rows
Is this the behaviour you require? If not please clarify further in the original question as an update/edit.

Query/Expression for Previous Month

Used as an expression in Access 2010, the below returns, for example, AUG15.
Left(MonthName(Month(Date())),3) & Right(Year(Date()),2)
How do I modify this to return the previous month, i.e. JUL15?
Start from the DateAdd expression which #Sam suggested ...
? DateAdd("m", -1, Date())
7/13/2015
Next use Format to present it as 3-letter month plus 2-digit year ...
? Format(DateAdd("m", -1, Date()), "mmmyy")
Jul15
If you want the month in all caps, feed the previous expression to UCase ...
? UCase(Format(DateAdd("m", -1, Date()), "mmmyy"))
JUL15
Note those examples are from the Access Immediate window, but those expressions (without ?) will work the same in your query.
You should look at the DateAdd function:
DateAdd ( interval, number, date )
Depending on your exact requirements, you could use it to substract a month from the current date like so:
DateAdd(m, -1, Date())
...or to build upon your expression:
Left(MonthName(Month(DateAdd(m, -1, Date()))),3) & Right(Year(DateAdd(m, -1, Date())),2)
to get records on same day of last month,eg. today is 19/12/21,and get records on 19/11/21 , you can use parameter query and enter the date required.
If every records of last month, ie from 1/11/21 to 30/11/21, two columns in query should be created to identify the month and year required. Make it clear,2 columns in query m:month(date()) and y:year(date()) and in criteria row put criteria of month and year required. If for last month criteria for m column is IIF(month(date())=1,12,month(date())-1), for y column is IIf(month(date())=1,year(date())-1,year(date())).
IIF is for when current date is in January.

Create Single Colum Aggregat IN SSRS Matrix

We have a SSRS Matrix report with the following areas
RowGroup:MonthYear
ColumnGroups:Campaign,Year,Processed
Detail:Sum(Processed)
We have added a single column outside of the ColumnGroup for and expression that will show the increase/decrease of current year processed records over previous year processed records
The data is shaped like this:
lYear, MonthYear, Campaign, Processed
2014, JUL-10, XYZ, 120
2015, JUL-10, XYZ , 60
So the formula is basically CurrentYearProcessed/PreviousYearProcessed which in this example would yield 50%
So how can we specify this when writing the expression?
Just use IIF to filter for the year:
=SUM(IIF(FIELDS!lYear.VALUE = YEAR(GETDATE()), FIELDS!Processed.VALUE, 0) / SUM(IIF(FIELDS!lYear.VALUE = YEAR(GETDATE()) - 1, FIELDS!Processed.VALUE, 0)
This checks your lYear field to see if it's the same as the current year [ YEAR(GETDATE()) ] and sums the Processed field. Then it divides by the previous year's SUM using similar logic.