Hello All, I've seen a few other similar topics on here but haven't found one that worked for me but I'm hoping it might be fairly simple...
I have a field in my data that reflects YYYY-MM based on a formula of a more complicated date field. I'd like to filter on this field to include only the prior month from the current date. So if the current date is today (05/02/2024) the filter would bring in everything where that field reflects 2024-04.
Solucionado! Ir para Solução.
@cgoad61
We can use the combination of DateTImeToday(), DateTimeAdd and DateTimeformat to arrive the "Previous" Month as below.
@cgoad61 - please see attached workflow. Hope this helps!
This is slightly different approach than @Qiu. I used this within Filter tool:
[DateField] = Left(DateTimeAdd(DateTimeFirstOfMonth(), -1, 'months'), 7)
**You can use either DateTimeToday() or DateTimeFirstOfMonth() since only extracting the first 7 characters of the date to get the Year-Mo. I oftentimes forget the syntax for Alteryx date time format, hence why I used the Left() function. This is my typical approach to getting Year-Mo.
Thank you both! Either option works although for this case I ended up using Qiu's.
@usmanbashir
Thank you for letting me the function "DateTimeFirstOfMonth()" 😁