SSRS Count and Expression function - reporting-services

I am trying to count the number of packages which belong to the Area by using the count. Every Area has different number of Packages.
How can I use Count here and check how many packages for a specific Area.
Also there is a attribute called 'Delivered' with defined values as D,N,P.
I want to check and calculate how much percentage of packages are in state 'D'.
Can anyone help.
I tried using the count but no luck.
=Count(Fields!Delivered.Value = 'D')

To get a count of specific records you can use something like this.
= SUM(Fields!Area.Value = "abc", 1, 0)
To get a percentage of the Delivered field do something like
=Sum(IIF(Fields!Delivered.Value = 1, 1, 0), "DataSet1")
/ Count(Fields!Delivered.Value , "DataSet1")
Make sure you change DataSet1 to match the dataset that the Delivered field comes form (you must include the quotes)

Related

Trouble creating nested SUM IIF expression in SSRS

I am new to SSRS and have a SUM(IIF question.
My data set contains four columns: Date, GroupID, PlanPaid, and NetworkIndicator.
Here is an example of the data set:
I am trying to SUM the [PlanPaid] amount when [NetworkIndicator] = "In Network".
However, I need this amount broken up by the [Date]. I tried accomplishing this by creating the expression:
=Sum(IIf(Fields!NetworkIndicator.Value = "In Network"
, Fields!PlanPaid.Value
, Nothing)
, "Claims_Rolling12")
But this expression returns the same amount (total) across all [Dates]. How do I break it up so that it is grouped by the correct [Date]?
Here is a photo of my Tablix and my current Groups: [Tablix and Groups]
And here is a photo of the output: [Output]
You haven't said where you want this sum to appear, so the answer here might not work. If it doesn't then edit your question to show what you expect the output to look like based on your sample data.
I'm assuming here that you want to add a new column to the report that shows "In Network total" by date.
The easiest way to do this is to add a row group that groups by date, then within this group you can use a simple expression, like the one you tried, but without specifying the scope.
=SUM(IIF(Fields!NetworkIndicator.Value = "In Network", Fields!PaidPlan.Value, Nothing))
This expression will only sum rows that are within the current scope, in this case the scope will be the row group you created to group by dates.
As IO said, if this is not helpful, edit your question and show what you expect your end result to look like, based on the sample data you supplied and then I can look at it again.

How to use multiple conditions in IIF expressions in ssrs to return a value

I am a beginner in SSRS and maybe this may sound easy, I have a dataset like below.
What I want to achieve is:
For column region and country I used a Row Groups. For column New lead I used this expression =IIF(Fields!TextA.Value=Fields!TextB.Value AND Fields!Subject.Value = "New Lead" AND NOT(Fields!Category.Value = "Closed"), Fields!Total.Value + 1, nothing) to get Total value for each Subject and just change the harcoded value for Fields!Subject.Value for Column Contract, Qualify but the value is not populated. I Checked there is no typo for hardcoded value. I can achieved this by using matrix but the columns arrangement for new Lead, Contract and Qualify is not like I wanted.
It sounds like you're thinking programmatically and adding the total one by one.
Fields!Total.Value + 1
You want to SUM the Totals if it matches the given Subject (and A = B and Not Closed).
=SUM(
IIF(Fields!TextA.Value = Fields!TextB.Value AND Fields!Subject.Value = "New Lead" AND NOT(Fields!Category.Value = "Closed")
, Fields!Total.Value, 0))
Are TextA and TextB always the same? If so, you can remove that part.
You're probably also going to need to Group By your Area to make it look like your mock-up - otherwise Thailand would sum up Bangkok and Phuket.

Calculated field in SSRS

I have tried to create a calculated field that will show the number of customer transactions processed within 15 minutes.
I have added the expression:
=count(fields!wait.Value<15)
However, when I run the query I'm getting the error message : 'expression used for the calculated field includes an aggregate RowNumber...'
Can you advise please on how to create a calculated field so I can capture the value I want?
I have tried = SUM(IIF(Fields!wait.Value < 15 , 1, 0)) to no avail.
With many thanks.
Calculated fields added to datasets can't have aggregate functions. The calculated field is essentially adding an extra column to your dataset. It sounds like you may want a variable? Used elsewhere in the report, your second expression would work, or the similar
=Count(IIf(Fields!wait.Value<15, 1, Nothing))
would work too.

Issue with Line Graph in SSRS

I am pulling my hair our trying to format a line graph.
Below is my current report - :
The Line Graph I have created has a Category Group of "YearLogged" and "MonthLogged".
The series I have added is an expression -
=Count(IIF(Fields!InvoicePaid_.Value = "Yes" And Fields!ProcessTarget.Value = "InTarget", 1, Nothing))
As you can see the data label is coming back as values in "Paid" column from my table. What I want is the percentages instead labelled.
Also the Y axis is coming back with the total Paid invoices as a percentage? That's not right I want that to show up to 100%.
I just want to show what % of invoices are being paid In Target over the month.
Another question - where is the legend title getting "Process Target" from? Can I rename that to what ever I want?
The problem for the line in your chart is that it is based on the number of records that meet your criteria rather than a percentage of the total. Apparently you changed the axis for a percentage but that doesn't aggregate the data for you. You'll need to change your formula to something like:
=SUM(IIF(Fields!InvoicePaid_.Value = "Yes" And Fields!ProcessTarget.Value = "InTarget", 1, 0)) / COUNTROWS()
The Legend uses the name of your field or a custom name in the Label field of the Values. In the Values' Series Properties Legend tab, you can use Custom Legend Text. If it's just one line as in your chart, I usually remove the legend altogether.
Try this:
=CDec(Count(IIF(Fields!InvoicePaid_.Value = "Yes" And Fields!ProcessTarget.Value = "InTarget", 1, Nothing))) / CDec(Count(IIF(Fields!InvoicePaid_.Value = "Yes", 1, Nothing)))
I simply took your expression and divided it by the number of invoices that were paid. These two numbers were converted to decimals so the division would give you accurate results.
From there, you should format the number as a percentage using the Number tab in the series/category/chart properties, and give it however many decimal places you like.
Managed to get this to work -
added the following expression to my series.
=SUM(IIF(Fields!InvoicePaid_.Value = "Yes" And Fields!PaidTarget.Value = "InTarget", 1, 0))/Count(IIF(Fields!InvoicePaid_.Value = "Yes", 1, Nothing))

Running Value Chart in SSRS - How to get each series to start at 0?

I have a table in SSRS, with income from two campaigns.
My columns are:
serialnumber
DateOfPayment
PaymentAmount
DaysSinceCampaign
Campaign
I want my chart to plot a running total of paymentamount by DaysSinceCampaign for each campaign (bs13 and bs12). I'm pretty close, as shown above - but for some reason, the BS13 campaign starts at 20,000, appearing to be adding on to BS12 - when it is supposed to start at 0.
In the Values section for Chart Data, I have used this formula:
=RunningValue(Fields!PAYMENTAMOUNT.Value,SUM,nothing)
I have tried changing 'nothing' to "campaign", and have tried defining 'Campaign' as a row group and a column group - but it keeps returning the same error: that the scope parameter must be set to a string constant equal to a containing group.
The scope here needs to be the name of the Series Group you set up in the chart, not the Column Group of the Tablix that is set up below, something like:
I created a simple test based on:
With the Chart data expression set to:
=RunningValue(Fields!PaymentAmount.Value, Sum, Nothing)
I got the following:
Which is incorrect, but similar to what you're seeing.
If I change the expression to:
=RunningValue(Fields!PaymentAmount.Value, Sum, "Chart1_SeriesGroup1")
I get the following:
Which is correct, so it seems like you're just going to have to set the Scope to the correct Series Group name.