Hello,
I want to calculate a duration between two dates for a specific population. I wrote this formula but the result but I can't find the desired result.
if [type_de_contrat]="Contractuel"
then DateTimeDiff([date_de_debut_contrat],[date_de_fin_prev_contrat],"MONTHS")
else 0
endif
Thanx for your help.
Solved! Go to Solution.
@Oumag your formula seems to be correct. please check the datatypes of the date fields are DateTime/Date type.
Hi Oumag. I Tried your formula with some sample dates I have and The formula is fine and I get a result, see below:
it would help if you could share a sample of your workflow and maybe specify what is the result you are looking for?
You probably want to switch [date_de_debut_contrat] and [date_de_fin_prev_contrat].
If you provide some sample data with expected output, then I'm sure @binuacs can solve it! :)
thanx for your help :
A sample of your data would help here, but you need to parse your dates first.
You can create a new field in a Formula Tool with the expression,
datetimeparse([my_date_field_as_a_string], '%d/%m/%Y')
Also, your years are "0001"?
@Oumag There are some invalid dates like 01/01/01 will become NULL when you convert it into Alteryx DateTime
Thanx a lot for your help, @binuacs your solution is OK !!!