Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In my Master Calendar in my Edit Script I have used the following:
If(Datum <= Today() And Datum >= SetDateYear(Today(), Year(Today())-1), 1, 0) As Last12Months
Now I want to add a similar If-statement for Previous 12 Months. How do I script this (in a similar way as above)?
I am using this to be able to compare data for the last 12 months and the previous 12 months a year earlier. In a bar chart for example.
I would try these instead
Last12Months
If(Datum <= Today() And Datum >= AddYears(Today(), -1), 1, 0) as Last12Months
Previous12Months
If(Datum <= AddYears(Today(), -1) And Datum >= AddYears(Today(), -2), 1, 0) as Previous12Months
Try using a sort expression like this
Max(MonthYear)
If that still doesn't work, please share a sample file
try this :
If(Datum <= Today() And Datum >= AddMonths(Today(), -12), 1, 0) As Last12Months
Regards!!!
I would try these instead
Last12Months
If(Datum <= Today() And Datum >= AddYears(Today(), -1), 1, 0) as Last12Months
Previous12Months
If(Datum <= AddYears(Today(), -1) And Datum >= AddYears(Today(), -2), 1, 0) as Previous12Months
Now the graph looks like this. I did use MonthYear though instead of Month. When I use Month it does give the bars for each month next to each other. But the month January should be last in row, and it shows first in row. How do I solve this?
May be use Month as a dimension instead of MonthYear here
But then January 2019 shows on the left instead of the right. It is supposed to be a dynamic graph that changes when the date changes.
Use a sort expression to fix this... it shouldn't be too hard to use a sort expression. If you are unable to do this, please share a sample so that we can try out and get you the right sort expression
I tried all different ways of sorting, but none gives me sort by date. I guess because it only recognizes Month when using that as a Dimension?
Try using a sort expression like this
Max(MonthYear)
If that still doesn't work, please share a sample file