We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Date Month Difference Issue

DelData
9 - Comet

hi there,

 

I am trying to get the month difference in the Date column but when i use DateTimeDiff i get Month Count for 01/08/2024 as 3 when all August Dates should be 2......

 

What i want is 

Current Month       : Month Count = 1

Current Month -1   : Month Count = 2

Current Month -2   : Month Count = 3

Current Month -3   : Month Count = 4

Current Month -4   : Month Count = 5

etc....

 

 

Green Wanted...Red is what i getGreen Wanted...Red is what i get

5 REPLIES 5
DataNath
17 - Castor
17 - Castor

Hey @DelData, as you were adding a +1 to compensate, this was causing the issue I believe. If you set both dates (today & the dates in question) to the first of the month in order to get a true month difference then that looks to solve the issue - I've checked the 3 you highlighted in particular:

 

DateTimeDiff(
DateTimeFirstOfMonth(),
DateTimeTrim([Date],'firstofmonth'),
'month')
DelData
9 - Comet

dooh!!! thank you....this works perfectly.....thanks for taking time out to help me 😀

aatalai
15 - Aurora

@DelData does this help

DelData
9 - Comet

Thank you....this is a solution that works great to....thank you for helping 👍

 

aatalai
15 - Aurora

@DelData happy to help - also as a FYI you can mark more than one post as a solution

Labels
Top Solution Authors