Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'd like to create a line chart with Year-Month as a dimension and the difference between PY and current year sales as a measure, so for example if we have the following dataset:
LOAD * INLINE[date, year, sales2019-01, 2019, 1502019-02, 2019, 2002019-03, 2019, 5502018-01, 2018, 2002018-02, 2018, 4002018-03, 2018, 300];
I'd like the chart to display:
2019-01: -50
2019-02: -200
2019-03: 250
Is there a way to achieve this?
you could try to solve it inside the script:
TABLE:LOAD *,Date(MakeDate(year-1,Right(date,2)),'YYYY-MM') AS date_p,;LOAD * INLINE[date, year, sales2019-01, 2019, 1502019-02, 2019, 2002019-03, 2019, 5502018-01, 2018, 2002018-02, 2018, 4002018-03, 2018, 300];
Left Join (TABLE)LOADdate AS date_p,sales AS sales_pResident TABLE;
After that, you could use this expression:
sum(sales)-sum(sales_p)
sum({<year={'$(=Max(year))'}>}sales)-sum(sales_p) ---> if you want to see only last year