Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have the data as shown below:
load * inline [
Date,Sales
01/01/2015,10
01/02/2015,20
01/03/2015,30
01/04/2015,40
01/05/2015,50
01/06/2015,15
01/07/2015,25
01/08/2015,35
01/09/2015,45
01/10/2015,55
01/11/2015,65
01/12/2015,10
01/01/2016,20
01/02/2016,30
01/03/2016,40
01/04/2016,50
01/05/2016,15
01/06/2016,25
01/07/2016,35
01/08/2016,45
01/09/2016,55
];
I want to show cummulative sum of sales.
For example If Month, SEP selected, I want to show the sum of values of sales from JAN to SEP in a Line chart.
How to achieve this?
Like the attached?
Expression:
Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date)), 'DD/MM/YYYY') & '<=' & Date(Max(Date), 'DD/MM/YYYY'))"}, Month, Year>}Sales)
PFA for front-end solution.
Like the attached?
Expression:
Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date)), 'DD/MM/YYYY') & '<=' & Date(Max(Date), 'DD/MM/YYYY'))"}, Month, Year>}Sales)
Or if you want to get both the year's data in a single line, then may be this
Cummu_Sales:
load *, Month(Date) as Month,Year(Date) as Year, Num(Month(Date)) as MonthNum;
load date#(Date,'DD/MM/YYYY') as Date,Sales inline [
Date,Sales
01/01/2015,10
01/02/2015,20
01/03/2015,30
01/04/2015,40
01/05/2015,50
01/06/2015,15
01/07/2015,25
01/08/2015,35
01/09/2015,45
01/10/2015,55
01/11/2015,65
01/12/2015,10
01/01/2016,20
01/02/2016,30
01/03/2016,40
01/04/2016,50
01/05/2016,15
01/06/2016,25
01/07/2016,35
01/08/2016,45
01/09/2016,55
];
Expression:
Sum({<MonthNum = {"$(='>=1<=' & Max(MonthNum))"}, Month>}Sales)