SSRS Position calculate Expression - reporting-services

I am trying to show the Postions of student on the basis of aggregate (aggregate )
The Aggregate expressions calculating on basis of (FINAL + MOCK + Asst)/3 which m doing on run time expression calculate...
Now i am unable to display the position positions Column highest the aggregate highest positions(1 OR 2 OR 3 ) positions
Is there any expression i can write to show positions column.
please help me m stuck

There's not a function that you can use - you'd just need to use some IIFs:
=IIF(FIELDS!Final.VALUE >= FIELDS!Mock.VALUE AND FIELDS!Final.VALUE >= FIELDS!Asst.VALUE, 1,
IIF(FIELDS!Mock.VALUE >= FIELDS!Final.VALUE AND FIELDS!Mock.VALUE >= FIELDS!Asst.VALUE, 2, 3))

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 Filter Expression by date range

I have an expression that outputs the number of rows: =CountRows("DataSet1").
I want to filter it by date range using parameters in order to output the number of rows within that range.
I have tried this: =CountRows(IFF Fields!DATE_OF_REQUEST.Value, "DataSet1" >= Parameters!startDate.Value
AND Fields!DATE_OF_REQUEST.Value, "DataSet1" <= Parameters! endDate.Value
("DataSet1"))
How can I achieve the desired output?
Probably not the most efficient solution, but, is the way I go about making date range reports:
I would apply the date range in the where clause of your dataset:
WHERE Date_of_Request between #startDate and #endDate
For this, I would create another identical dataset that just looks at distinct records and apply the where clause to get the most accurate figure.
I'm assuming the logic in your COUNTROWS expression is correct here...
What you need to do is evaluate each row and if it matches you criteria return 1 else return 0 then sum the results of this. So you can modify you expression slightly like this.
=SUM(
IIF(
Fields!DATE_OF_REQUEST.Value >= Parameters!startDate.Value
AND Fields!DATE_OF_REQUEST.Value <= Parameters!endDate.Value,
1,
0,
"DataSet1"
)
)
I'm doing this from memeory so the position of the scope "DataSet1" might be incorrect.

Using timestamp in where with count in having clause

I am trying to use a datediff function in my where clause and need to use a count function in having clause but I need to use OR function ie select loans from clients in the past 2 months or count of loans should be more than 50
I tried to use UNION clause wherein I specify the datediff part in one part of the code and the count function in the other part but I am getting duplicate values because of the count function.
where FundedBit = 1
and SellerStatusTypeId = 1 -- Approved
and lu.DelegatedUnderwritingBit = 1
and cml.LastFileDeliveryCompletedDtTm is not Null
group by
p.PrimaryEmailAddrTxt,
s.SellerSalesExecPersonId,
s.SellerPartyId,
s.SellerNum,
s.PartyName ,
having (count(lc.LoanId) >= 50 or (cml.LastFileDeliveryCompletedDtTm <= convert(date,DATEADD(month, -2, GETDATE())))) ----I need output if either of this two gets executed
I am getting an error like "Column 'cml.LastFileDeliveryCompletedDtTm' is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY clause"

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.

SSRS Charts data

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.