technology and project consulting

Topic Thursday:
how to refer to the current day

Alteryx tips from our expert Alexander Gross

03/03/2022
Alteryx, M2, Blog

Seventh part of our series "Topic Thursday" with valuable tips and insights around the topic Alteryx. The articles are written by our colleague Alexander Gross, Business Intelligence Consultant and Alteryx Lead at M2.

It doesn't matter if you only need to filter out the last week, the current month or the current year from a data set, the problem is always the same: How do I ensure that this workflow will still work a week, a month, or a year from now? The answer is simple: we refer to the current date. I'll show how to refer and use the current date in this Topic Thursday.

This can be done in several ways. In the following, I present the most important three:

1. Filter

If we want the dates of today, yesterday or tomorrow compared to the current date, we can also set this in the filter tool without having to use a formula or another tool. Once we select a date field in the basic filter, besides the possibility to choose a fixed date, we also have the option to use dynamic dates.


 

2. Formula

However, in many cases it is not enough to have only these three options, but we need more flexibility. In this case we have the option to use the DateTimeToday() or DateTimeNow() functions. The difference between the two is that DateTimeNow also contains the time (to the second), while DateTimeToday only maps the current day. With the additional function DateTimeAdd we can now e.g. filter out the last 30 days from a data set or build much more complex queries.

DateTimeAdd(DateTimeToday(),-30,'days')

The function consists of three parts: a date field, the number we want to add or subtract and the unit in which we want to subtract. So besides 'days' there is also the possibility to subtract 'months' or 'years' from the data.
 

3. Timestamp tool (DateTimeNOw)

Another option is the timestamp tool (DateTimeNow), which gives you many options for formatting the date directly.



 

 

Every second Thursday is Topic Thursday: our colleague Alexander Gross, Business Intelligence Consultant & Alteryx Lead at M2, shares his expert knowledge on workflow building in Alteryx. With his tricks and tips, you can use Alteryx even more efficiently.

 

Do you have any questions about this article or about Alteryx in general? Then please feel free to contact us at any time. We look forward to exchanging ideas with you.

Your M2 team

Phone: +49 (0)30 20 89 87 010

info@remove-this.m2dot.com  ·  M2@Facebook  ·  M2@Twitter  ·  M2@LinkedIn  ·  M2@Instagram