Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I wanna calculate the Sum of the Sales for one year and the previous for different companies.
However, I do not want a value for 2010 as there is no value to be calculated.
Currently it sums up for example
A, 2015, 100
+
B, 2010, 100
as it seems to go row by row. How can I fix this?
z:
load * inline [
Company, Year, Sales
A, 2010, 100
A, 2011, 110
A, 2012, 120
A, 2013, 130
A, 2014, 140
A, 2015, 100
B, 2010, 100
B, 2011, 110
B, 2012, 120
B, 2013, 130
B, 2014, 140
B, 2015, 100
C, 2010, 100
C, 2011, 110
C, 2012, 120
C, 2013, 130
C, 2014, 140
C, 2015, 100
];
zz:
load Year,
Sales + Previous(Sales) as TwoYearSales
Resident z;
Hi,
Is it your requirement?