Hi Alteryx community,
I've been wrestling with this one, but I have a workflow I'm putting together where a field name changes every month based on the following parameters:
I am using 2024 as the current year and 2023 as the prior year in this example, but this attribute is dynamic as well.
| If today's month is... | Then the field name should be... |
| January of the current year | Sum of Jan - Dec 2023 [prior year] Flows |
| February of the current year | Sum of Jan 2024 [current year] Flows |
| March of the current year | Sum of Jan - Feb 2024 Flows |
| April of the current year | Sum of Jan - Mar 2024 Flows |
| May of the current year | Sum of Jan - Apr 2024 Flows |
| June of the current year | Sum of Jan - May 2024 Flows |
| July of the current year | Sum of Jan - Jun 2024 Flows |
| August of the current year | Sum of Jan - Jul 2024 Flows |
| September of the current year | Sum of Jan - Aug 2024 Flows |
| October of the current year | Sum of Jan - Sep 2024 Flows |
| November of the current year | Sum of Jan - Oct 2024 Flows |
| December of the current year | Sum of Jan - Nov 2024 Flows |
I tend to wrestle with datetime conditional formulas and I've attempted many variations but they either return a malformed if statement or error that the formula can't convert the date. Any ideas you guys have would be so appreciated. Thank you!
¡Resuelto! Ir a solución.
Praise the freaking Lord, I figured it out. Gonna post solution in case anyone else runs into this issue.
I don't know why this works, but it works so if someone wants to comment about the data types that impacts this conditional formula, please let me know. Thank you!
If DateTimeFormat(DateTimeToday(),"%b") = "Jan" then
"Sum of Jan - Dec " + DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"year"),"%Y") + " Flows"
elseif DateTimeFormat(DateTimeToday(),"%b") = "Feb" then
"Sum of Jan " + DateTimeFormat(DateTimeToday(),"%Y") + " Flows"
elseif DateTimeFormat(DateTimeToday(),"%b") = "Mar" then
"Sum of Jan - Feb " + DateTimeFormat(DateTimeToday(),"%Y") + " Flows"
elseif DateTimeFormat(DateTimeToday(),"%b") = "Apr" then
"Sum of Jan - Mar " + DateTimeFormat(DateTimeToday(),"%Y") + " Flows"
else [_CurrentField_] endif