Calculating the mean for fluctuating data - average

Suppose we want to calculate the average annual balance of a customer in the bank.
If we want to have a normal average, we will add up the customer balance in the year and then dividing by the number of days in the year.
Now consider a customer who had a high balance only in the last month of the year and for the last 11 months his account balance has been very low. But because he had a high account balance only in the last month, his annual average shows a high number.
How can we design the annual average balance indicator in a way that 11 months of low customer balance affects his annual average and in fact the annual average of the customer does not increase only because of the last month?

Related

How to display month and YTD data on same group band in Crystal Reports

I am working on a productivity report. I need it to display units for the month along with YTD units.
Example:
Month units YTD Units
Staff (group 1)
Accounting Period (group 2)
Service Category (group 2)
Detail - services with minutes that are calculated into minutes. This may or may not be hidden.
Service Category (footer) Units sum for period Total Units sum
Page Break
Accounting period.... and so on until we run out of accounting periods for that staff with services, then onto the next staff.
Units are being calculated in a formula field based off of minutes of the service. How can I accurately display the year to date units? Everything I've tried hasn't worked. Perhaps I'm doing a running total wrong but it told me I couldn't use a formula field in it (units). I hope my explanation makes sense.

Paypal Subscriptions - Quantity based - Charge variable amount

On my application, I need to charge users a different amount at a set frequency.
Hourly Fee * No. of Hours = Sum to be charged
(user is expected to fill the timesheet basis which the number of hours will be calculated
and Hourly fee is fixed)
We will charge this sum every week or every month. I thought of using the Paypal's quantity based subscriptions API, but I am not able to find a way to change the number of hours for every period (since the number of hours would change in every period).
Please advise.

Modeling a schedule

I am simulating the process of an emergency room. I have a problem with patient arrivals.
I have the total number of annual patients, and the probability of distribution of arrivals over the different months and days of the week. For example: total number of arrivals 120000, which divided by the 52 weeks that make up a year is about 2308 per week and therefore 329 per day. However, if we are in May, I know that there are a few more arrivals, so I have to multiply the weekly arrivals by 1.05 and therefore 2423 per month.
Can I set up this reasoning through schedules?
The Source object has an option to create agents based on a database datable. Furthermore, it doesn't have to be a record per arrival but several arrivals at the same time. See here for more details.

Tableau - weekly average from daily data

Using Tableau 8.1.
Daily data like this:
Date Sales
1-1-14 $5
1-2-14 $2
...
6-15-14 $15
Which can be aggregated to weeks of course
Week 1 $15
Week 2 $12
Week 3 $10
Week 4 $13
etc.
I would like to get the weekly average of each month
So like this:
Weekly Average
Month 1 (weekly average of the weekly total sales) ($15+$12+$10+13)/4 = 12.5
Month 2
Month 3
Does that make sense? If ou simply put "average" in the tableau table, it gives the average daily value PER WEEK (or month) < - I don't want that. I want the average of the weekly totals per month.
Quite simple, actually.
Create these calculations
Unique Weeks = COUNTD(DATEPART('week',[Date]))
Weekly Average = sum([Sales])/[Unique Weeks]
Then simply report Weekly Average x Month (or Quarter or Year, etc.)
(Note: Some weeks have < 7 days).
This can be done very simply with one calculated field.
WINDOW_AVG(SUM([Sales]))
Then drag your Date pill onto the rows shelf twice, one aggregated to day, the other to week. Make sure pills are set to discrete (blue) and drag your Sales measure onto the shelf, also as discrete.

Calculate how many years there's left on a debt and print it in date format

I'm using Google Docs Spreadsheet and I want to calculate how many years there is left on a debt from a fixed date (YYYY-MM-DD), into a date (same formation).
Example: I started to pay off on a debt which are on 20 000, 2014-03-31. Every month, I'll pay 200 and the debt will be payed off 2022-03-31. If I change the pay sum (200) to another sum, the date will be based on the new sum and change the final debt year.
How can I accomplish this?
If you are satisfied with a more or less exact solution, you can write:
=A1+(30*D1/D2)
where:
A1 is your starting date (in date format), such as: 2014-03-31
D1 is your total amount of debt, in this example: 20000
D2 is your monthly sum of debt payed, in this example: 200
The formula simply counts how many months you need to clear the debt (D1/D2, which gives 100), and then multiples it by the average days of a month (30). Then it adds this amount of days to the starting date. Actually this example gives the result: 2022-06-17 as the final clearance of the debt.
As I said it's not fully exact as it counts 30 days as an average month and it does not count loop years, but I think that it can be used for your purpose.
I hope it helps.
UPDATE:
You'll get a little closer result to the exact value, if you use this:
=A1+(365*quotient(D1/D2,12))+(30*MOD(D1/D2,12))
The QUOTIENT function will calculate how many years are needed (in the example D1/D2 divided by 12). We multiply this value with 365 (the number of days in a year).
Then the MOD function calculates how many more months are needed after the years, which is the modulo of "D1/D2 divided by 12".
This function will give 2022-07-27 as a result for this example.