DateTimeDiff in Weeks
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I keep getting null value from DateTimeDiff function.
I want to calculate the week difference between product launch week and today.
Below are my formula and data:
Please advise.
Thanks,
Claire
Solved! Go to Solution.
- Labels:
- Date Time
- Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The reason for that is that the unit of "weeks" is not supported. You would have to use "days" and then divide by 7. This won't get you whole numbers. You'll need to use something like Ceiling() to get it to round up.
Cheers,
Mark
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Like MarqueeCrew stated, if you want it tp round up always:
Ceil(DateTimeDiff([Today],[Date],'days')/7)
or if you want it to round down always:
Floor(DateTimeDiff([Today],[Date],'days')/7)
or if you want it to round based on the number of days:
Round(DateTimeDiff([Today],[Date],'days')/7,1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you so much Mark! I'm able to get the correct numbers now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you so much for your deailed explination! Celi finction fits my situation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Years later and this is helpful but TODAY isn't working for me. I have only been using Alteryx a few days so maybe its something obvious. I tried:
Round(DateTimeDiff([Today],[Date],'days')/7,1) it is erroring as "Unknown variable "Today"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I found the answer so posting it here for other rookies!
Today has to be somewhere in the workflow so I had to add a separate formula for Today which was DateTimeToday() and then my calculation formula Round(DateTimeDiff([Today],[Date],'days')/7,1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have used the formula suggested to convert days to weeks (round(....)) and I still get a "null" result...any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
ignore that...although in the formula tool it says "null" it does seem to have worked when i have run it again
