Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
i've some sales data structured as below:
When a user select a period (or more than one), the total Sum of sales is recalculated for the selected period.
I would like to add another column with the total sum of sales for the selected period of the previous year (2017).
So, in this case, the new column will contains the sum of 01/2017,02/2017 and 03/2017 sales.
How to achieve this ?
Try this
Sum({<Year = {"$(=Max(Year) - 1)"}, Period, Month = p(Month)>}Sales)
Where Year and Month are calculated in the script like this
Table:
LOAD Company,
Date(Date#(Period, 'MM/YYYY'), 'MM/YYYY') as Period,
Year(Date#(Period, 'MM/YYYY')) as Year,
Num(Month(Date#(Period, 'MM/YYYY'))) as Month,
IsCurrentYear,
Sales
FROM
[SampleData.xlsx]
(ooxml, embedded labels, table is Foglio1);
Try this
Sum({<Year = {"$(=Max(Year) - 1)"}, Period, Month = p(Month)>}Sales)
Where Year and Month are calculated in the script like this
Table:
LOAD Company,
Date(Date#(Period, 'MM/YYYY'), 'MM/YYYY') as Period,
Year(Date#(Period, 'MM/YYYY')) as Year,
Num(Month(Date#(Period, 'MM/YYYY'))) as Month,
IsCurrentYear,
Sales
FROM
[SampleData.xlsx]
(ooxml, embedded labels, table is Foglio1);