Hello,
Goal: The graph should be a Monthly one which starts the range since a specific day (not the first day of the month).
Let’s say I wanna analyze the monthly traffic starting from the 9th.
Case A:
Now is: October 6th.
Range: Start September 9th, stop Now
Case B:
We passed October 9th, because Now is October 12th…
Range: Start October 9th, stop Now.
I was able to start the range since the 9th of the previous month, but this works only if the current month date is less than 9.
I determined the previous month with this code:
previous_month = data.truncate(t: now, unit: 2mo)
Then I added the wanted days:
starting_range = date.add(d: 8d, to: previous_month)
This is not a big deal because it is good only if… the current month day is less than 9. In other case I need to change the formula, but this is not I want.
Does not exist a kinda of “IF then else” statement to determine the starting range date?
I have searched it for at least 5 hours today and found nothing.
Thank you.