• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Help with statistics formula

 
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have the following case:
In my company, we have 2 components of sales :
* people --> direct selling done by salespersons
* online --> selling via internet : social media, google ads, etc.
everyday, we keep track of dollar amount each component generate, for example:
1 Jan 2015 --> people : US$23500.12, online : US$10017.5
2 Jan 2015 --> people : US$1754.3, online : US$12335.7
and so on.

we have a report that takes 2 parameters --> report start period, and end period. So, lets say we want to generate the report for Q1 2012, then the start period will be 1 Jan 2012 and end period is 31 Mar 2012. To generate the report of this period, first we pull the daily sales amount of both people and online sales amount. So, we'll have 31 + 28 + 31 = 90 records to process. and how we process these records (for brevity's sake, we'll use simple short numbers):
Data :
P : amount of sales generated by people
O : amount of sales generated by online
D : divisor used to compute gain percentage (made from various components)
DG : daily gain --> (P + O) / D
CG : cumulative gain --> ((prevDay CG + 1) * (DG + 1)) - 1

1-Jan-15 : P : 1.5, O : 2.1, D : 6, DG : (1.5+2.1)/6 = 0.6, CG : ( (0 + 1) * (0.6 + 1) ) - 1 = 0.6
2-Jan-15 : P : 2, O : 1.7, D : 7, DG : 3.7/7 = 0.53, CG : ( (0.6+1) * (0.53 + 1) ) - 1 = 1.448
3-Jan-15 : P : 1.7, O : 0.5, D : 9, DG : 2.2/9 = 0.24, CG : ( (1 + 1.448) * (1 + 0.24) ) - 1 = 2.0355
and so on until 31-3-15

as you can see in the iteration, we get the cumulative gain (combined from people and online). Is it possible to extract the cumulative gain from online only?
thanks
 
Marshal
Posts: 69847
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you create the formula for cumulative gain?
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, what do you mean with how I created the formula? co9uld you be more specific? it's just like this : ((prevDay CG + 1) * (DG + 1)) - 1
thanks
 
Campbell Ritchie
Marshal
Posts: 69847
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get that formula from? What will the CG be when you have cumulated it over 99 days?
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I know the number seems very big, but that's just because it's an sample number. In reality, the divisor will be quite big and most of the time, daily gain will be negative (impossible to score positive gain that frequently). and if you ask me where I got that formula from, the answer is...from my boss, so.....
thanks
 
Campbell Ritchie
Marshal
Posts: 69847
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am pretty sure you can write similar formulae for the right and left halves of the daily and cumulative gains, but I am a suspicious so‑and‑so who is starting to wonder whether you are actually calculating the right thing.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
trust me, I was skeptical at first, but I have been "enlightened" now and see that this formula is indeed correct.
can you show me how to extract "online" part only? I tried by using the exact same formula with including only the online part and people part separately, and it's just wrong, the number didn't add up. thanks
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what I meant with the number didn't add up is that when you calculate the people daily gain and online daily gain separately using just P/D and O/D and derive their respective cumulative gain separately, the sum of both people's CG + online's CG is not equal combined CG.
Thanks
 
Campbell Ritchie
Marshal
Posts: 69847
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would have to work out some divisor, but I don't know how to do that, and probably can't help any more, I am afraid.
 
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic