This project has moved and is read-only. For the latest updates, please go here.

Compare each months average value for previous year against todays value.

Jul 19, 2011 at 1:27 PM

 Im curently trying to figure out the best way to tackle the following problem. I need to compare the previous years monthly average against todays value.

X: To be calculated based on monthly average 2010 . Y: Corresponds to daily volumes in 2011 to be compared to monthly average of the same month in 2010.

The data is recorded within a SharePoint List column name "AccountOpening". I currently compare against the yearly average of 2010 as opposed to each month average in 2010, because its a yearly average all I need to do is insert a fixed value (calculations are not done in code).

Can anyone point me in the right direction :) ???

function Results1(xData, status) {   

  var AccountOpening = [];     
 AccountOpening[i] = Number($(this).attr("ows_AccountOpening"));      i = i + 1; });       

var AccOpArrow1=" ";  
var AccOpArrow7=" ";
var AccOpArrow30=" "; 
var AccOpAr1 = ((AccountOpening[0]/AccountOpening[1])-1)*100; var AccOpAr7 = ((AccountOpening[0]/AccountOpening[7])-1)*100; var AccOpAr30 = ((AccountOpening[0]/AccountOpening[30])-1)*100;    

if ( AccOpAr1 >= 20){AccOpArrow1 = "redarrowup.png";}else if (AccOpAr1 < -20){AccOpArrow1 = "RedArrowDown.png";} else if (AccOpAr1 >= 10){AccOpArrow1 = "yellowarrowup.png";} else if (AccOpAr1 < -10){AccOpArrow1 = "yellowarrowup.png";} else     if(AccountOpening[0] > AccountOpening[1]){AccOpArrow1 = "GreenArrowUp.png";}else {AccOpArrow1 = "GreenArrowDown.png";}     

 if ( AccOpAr7 >= 20){AccOpArrow7 = "redarrowup.png";}else if (AccOpAr7 < -20){AccOpArrow7 = "RedArrowDown.png";} else if (AccOpAr7 >= 10){AccOpArrow7 = "yellowarrowup.png";} else if(AccOpAr7 < -10){AccOpArrow7 = "yellowarrowup.png";} else if(AccountOpening[0] > AccountOpening[7]){AccOpArrow7 = "GreenArrowUp.png";}else {AccOpArrow7 = "GreenArrowDown.png";}   

   if ( AccOpAr30 >= 20){AccOpArrow30 = "redarrowup.png";}else if( AccOpAr30 < -20){AccOpArrow30 = "RedArrowDown.png";} else if ( AccOpAr30 >= 10){AccOpArrow30 = "yellowarrowup.png";}else if (AccOpAr30 < -10){AccOpArrow30 = "yellowarrowup.png";} else     if(AccountOpening[0] > AccountOpening[30]){AccOpArrow30 = "GreenArrowUp.png";}else {AccOpArrow30 = "GreenArrowDown.png";} 
Jul 19, 2011 at 6:51 PM


It's pretty hard to figure out what you're trying to do here, especially without understanding the underlying list structure.

Is this an SPServices question or more of a general "how do I do this?" question?