Issue with Line Graph in SSRS - reporting-services

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))

Related

Hide Empty Zero Data Points in SSRS Line Chart

I have an SSRS line chart that I need to figure out how to hide empty data points - stop the line from making markers/continuing the line where Category Group values are zero:
The values and series and groups are setup as so:
With the data looking like this:
I have tried filtering both at the chart level and the Category Group levels to filter out data that would create groups for Series 2020 and Category October/November/December, this creating or filling those points in my mind:
Where the expression is "=DateSerial(YEAR(today()),MONTH(today()), 1)" achieving the net result of filtering out data points/rows that from an incomplete month - meaning when the report would be run on 10/10/2020, only data from before 10/1/2020 should be used to generate groups.
The problem is that you are using COUNT() which will always return a value, zero if there are no records to count.
I created a simple dataset and using count of FILE_NUMBER I got this (replicating your issue) ...
The easiest way round this is to change the value expression to something like this...
=SUM(IIF(Fields!FILE_NUMBER.Value = Nothing, 0, 1))
This way we add 1 to the sum for every non-empty value and nothing if it's empty. If the total sum is still empty, by default, the chart will not plot that point.
So we end up with this...

SSRS Count and Expression function

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)

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.

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.

RuningValue not working to give Cumulative Stacked Chart

I have a dataset that is showing the correct data, but putting it into a stacked bar chart and using the RunningValue function to try and plot it cumulatively is giving numbers that start way higher than they should.
My data is aggregated at the database, giving a dataset of:
Date of data
Count
Sum of Value
Filter Item 1
Time Since Date
Stacking Category
5 other fields
I am plotting with Time Since X along the X axis, Stacking Category is my Series field (there are 4 possible options), and my Y is using this function:
=RunningValue(IIF(Parameters!VolumeOrValue.Value="Volume",
Fields!Count.Value,
Fields!SumValue.Value),Sum,Nothing)
This should show me in the first X bar only 1 of the series, with a count as 1, or value of 100. Instead I get 3 of the series, with Counts summed up to 2500, which is more than the total sum of all of the count fields.
Can anyone point me to where my problem is?
Edit: Setting the CategoryField in the Series Properties dialog to match the Catgory that is set for the chart means that each bar is increasing by the right amount, but each stacked slice starts at the size of the entire value of the last bar. I need to get the reset to work properly, but I can't set any "Groupings" as normally recommended, and choosing any field name or Series name causes an error.
I managed to get it working quite simply...
Clicking on the Field on the right hand side of the chart on the Drop Series Fields Here section has a Group properties which when expanded has a name of the grouping. Plugging this into the RunningValue function as the last argument got it working properly (after removing the CategoryField setting).