I have:
[A]: 05/08/2023
[B]: 05/08/2022
and I want to output the number of days when subtracting [A] - [B], in this case 365. How do I achieve this?
Solved! Go to Solution.
Hey @rafatomillero, you can leverage the DateTimeDiff() function for this case. However, beforehand, you need your dates to be in a format that Alteryx can understand (YYYY-MM-DD), hence why you have to wrap each in the DateTimeParse() function. I've guessed that your current format is dd/mm/yyyy, but if it's mm/dd/yyyy, all you need to do is swap the %d and %m around.
Find attached the way of doing this.
Let me know if there is any issue and do not hesitate to mark this answer as solution if it helped.
Hey @rafatomillero,
First thing to do is convert your text date to the Alteryx date format as currently your date is ambiguous it could be a US or UK date for instance. To do this I used the date time parse formula. Then your have two options:
Option one is to pivot your data onto one line using the Cross Tab Tool. This allows you to just use a normal row level formula:
Option two is to use a multi row formula to do calculations across multiple rows:
Here are some useful links for these topics: https://community.alteryx.com/t5/Learning-Paths/Getting-Started-Learning-Path/ta-p/475117#done
Multi Row Formula Tool https://community.alteryx.com/t5/Interactive-Lessons/Multi-Row-Formula/ta-p/82872
Date Functions: https://help.alteryx.com/20221/designer/datetime-functions
Any questions or issues please ask
Ira Watt
Technical Consultant
Watt@Bulien.com
Very helpful, thank @DataNath !