How to create a date index in DAX?

If you want to use the date to create a date index column you can use the following DAX:

MyDateIndex =
 ( YEAR ( MyDates[Date] ) * 10000 )
+ ( MONTH ( MyDates[Date] ) * 100 )
DAY ( MyDates[Date] )

So if the date is 31st July 2018 this create an index of 20180731.

You can also do the same in M in the Query Editor window.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: