Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I want to create a rolling 13 months dimension , for a bar chart. but i dont know how to write the script.
Example: no is Nov 2022. so by putting this rolling 13 months, it will be Nov2021 - Nov 2022 ( 13 months right?)
expression: sum(sales)
Please help guys!
Instead of YearMonth you need to use your Datefield
Sum({<datefield = {">=$(=Date(AddMonths(Max(datefield),-12))) <=$(=Date(Max(datefield)))"}>} SUM_NET_SALES)
I tried to use this expression. but it only came out 2022 jan - 2022 Nov. is wrong.
Dimension YearMonth
Expression: Sum({<YearMonth = {">=$(=AddMonths(Max(YearMonth),-12)) <=$(=Max(YearMonth))"}>} SUM_NET_SALES)
and in the loading script, it shows
please help!
Instead of YearMonth you need to use your Datefield
Sum({<datefield = {">=$(=Date(AddMonths(Max(datefield),-12))) <=$(=Date(Max(datefield)))"}>} SUM_NET_SALES)