How to generate date and time interval list with DAX

Here is how to create a new table and generate a dynamic date and time interval list with DAX. In this example, I will build a table with a column that contains 15 minute intervals for the last 7 days.

To do that, I will use functions GENERATESERIES, TODAY  and principle “Date and time are just numbers”.

GENERATESERIES requires a few simple arguments.

GENERATESERIES(<startValue>, <endValue>[, <incrementValue>])

In this case – start date, end date and 15 minute interval as a value for incrementValue argument.

Date and time are just numbers

If we look at the 15-minute interval as a fraction of the day, then we can calculate that by using the same logic as in Excel. 15 minute interval equals 1 divided by 24 hours and divided with 4. Because in one hour we have 4 15 minute intervals.

Create DAX table with date and time interval column

First of all, go to the modeling tab and create a new table.

Give a name to the table and use GENERATESERIES to create a date and 15 minute interval list for the last 7 days. I don’t need the last 15 minute interval, and that’s why I subtracted one interval from the <endValue>.

You might have different argument separators.

Go to the field list and rename that column as you wish.

With the DATE function, you can create a static list of dates and times.

Or just a TIME function to create a static list of time intervals. As you can see, it is possible to define incrementation with the TIME function.

Take a look at this other post on how to generate time and date intervals with Power Query.

Special thanks to Muhammad for the question that was an inspiration to create this post.

2 comments on “How to generate date and time interval list with DAX

  1. muhammad yasir

    Hi Janis,

    Thanks for the article. I followed your article to generate the Date Time column with a half-an-hour interval. It produces the desired output. I have a quick follow-up question in this regard. Time is shown in AM/PM format. Is there anyway to generate time in 0:23 hour format and get rid of AM/PM.

Leave a Reply

Your email address will not be published. Required fields are marked *