How to exclude a value while calculating total based on other column in SSRS Calculation Expression - reporting-services

For more detail please go through the image
If Untrended MOM is 0,
Skip that record in the calculation. We basically treat both MOM and Total Cost as null.
Untrended YOC * Total Cost for each row. Sum all the results from that multiplication, then divide that result by the grand total project cost.
Example
enter image description here

Related

How to get the right result for average from averages in ssrs?

I have report with totals.
In the end I have average values from route points.
I want to get the average value per route points.
results
for example average for 2041 is 00:00:12
average for 2042 is 00:00:04
I want to get average from from 2041 & 2042
I received 00:00:12 which is not true..
For average and avg of avg i used the same expression :
=Format(
TimeSerial(0,0,
Round(
IIf(sum(Fields!N_ANSWERED.Value)=0,
0,
sum(Fields!T_ANSWERED.Value) / iif(sum(Fields!N_ANSWERED.Value)=0,1,sum(Fields!N_ANSWERED.Value))
)
)
),
"HH:mm:ss")
I expected ~ 00:00:08 as result.
An average of averages is rarely right.
For example, in group 2041 you appear to have higher call volume at lunch time, (12:00 to 13:00) as the calls take longer to answer, and lower call volume first thing in the morning (8:00). Let's say the average time to answer at 13:00 was 00:00:24 because 50 calls came in, but at 8:00 there was only one call which took 00:00:02 to answer. Now, the average of those two hours isn't (00:00:24 + 00:00:02) / 2 = 00:00:13 because the amount of calls is very different in the two samples making up the average.
The real average is the average for that group multiplied by the number of calls in that group divided by the total calls (00:00:24 x (50/51)) + (00:00:02 x (1/51)) = 00:00:23.57
If you are rounding to a precision of zero decimal places, that is still 00:00:24.
This is called the weighted average as each group's average influences the outcome depending on how many results are in the original calculation of the average for that group.
This is why your averages of 00:00:12 and 00:00:04 probably won't be 00:00:08, it will vary depending on how many calls are in each group. Now, if there are exactly the same number of calls in each group, then the average of averages will be the same as the weighted average (this is the only case where you would get 00:00:08).
The closer the total number of calls are in each group, the closer to the right result the average of averages will be, but it is an unreliable calculation. Conversely, the more the number of results in each group varies, the more the weighted average will skew towards the average of the group that is more highly represented in the results.
Now, if there are a lot of results in the 2041 group and very few in the 2042 group then the 00:00:04 average result for 2042 will hardly influence the overall average, which may lead to the outcome where the result for 2041 overwhelms the result for 2042 and the overall average is the same as the average for 2041 within your level of precision and rounding, as per the example above.
The fact that there are several missing hours in the 2042 result set makes me think this is the case.
So your calculation looks correct - the sum of the time taken to call divided by the number of calls will give you the average for the groups and for the overall average. It is just that the average of averages won't be the same result because the groups aren't equally represented in the data used to calculate the overall average.
Based on your expression, your overall average looks accurate at 00:00:12.
By referencing the rendered cell rather than the dataset filed you can so this quite simply.
1. Get the name of the cell containing the detailed average you have already calculated, let's assume this is called textbox1.
Then your expression is simply
=AVG(ReportItems!textbox1.Value)

How to calculate a derivative row in SSRS?

How do I calculate the last row (Avg Spend) in SSRS? This row is a derivative of the first two rows (Purchase Amt / # of Transactions)? I can't pre-calculate this value when building the dataset because I have many products in my list and I am using multiple-checkboxes. What I am trying to accomplish is I want to allow the user to see the Avg Spend of the different combinations of products they selected in the parameters.
Picture of dataset

How to get weighted average for CTR in MySQL?

Here is what my data looks like:
I would like to see a roll up of the total impressions, total clicks and average ctr for a given query. E.g.,
Except this is just an average of the ctr column values; whereas I need a weighted average.
I think this SO answer Calculate Weighted Average in sql for duplicate items is taking me most of the way there, but since this calculation involves two metrics (ie, impressions and clicks), it's a bit different.

Finding Total Pay by Certain Conditions

Generate a query to count and display the number of full time and number of part time employees, the total pay of all fulltime employees and the total pay of all the part time employees.
Workings:
So I have the fields Status and Total Pay. I added the field Status and the field Status again which is a Count but it is hidden. I then added a new field called "Number of Each Status Type". I then referenced it to Status and gruped it by count.
This gave the desired first two rows of the image.
I am not sure on how to get the third though. How would I get the Total Pay by Status. Any help will be appreicated.
It has look like this
What I have for Query

Calculate average for the those who meet a certain criteria

I'm trying to calculate the average for only particular records
For example, we have a field called FurthestSlide. This field will contain numbers. We have another field called SlideCount. This is also a number field.
I only want it to calculate the average for the records where the FurthestSlide does not equal the SlideCount number.
What I am trying to find is the average FurthestSlide number for those people who did not view the entire message.
I do not want those who finished the message to be calculated in the data.
Sample Data:
SlideCount=40
FurthestSlide=(30,20,40,40,40)
The answer should come out to 25. (30+20)/2
You can exclude certain rows from an aggregate.
With your data:
And a simple report:
I have calculated the average for non-matching rows with the expression:
=Avg(IIf(Fields!FurthestSlide.Value <> Fields!SlideCount.Value
, Fields!FurthestSlide.Value
, Nothing))
Here we set matched rows FurthestSlide value as Nothing, which means they are excluded from any average calculation.
This gives the required result for your data: