Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dbuck44
Frequent Visitor

New Date Column For Today

Trying to create a new custome Column called MthNum for the current month.

So if it's April 10, 2023 the value returned would be 4.  If it's Nov 22, 2024 it would return 11, and so on.  For Today's date, ie... when the user is using the system.

3 REPLIES 3
djurecicK2
Super User
Super User

Hi @Dbuck44 ,

 You can use the Month function to accomplish this:

Something like below- edit to fit your table and column names.

ColumnName= MONTH(Table[Datefield])

Here is some additional information

https://learn.microsoft.com/en-us/dax/month-function-dax

 

You can also create a measure to get the month of today's date like so:

Todays Month = MONTH(TODAY())

 

Please consider accepting as solution if this has answered the question.

 

I,m using the "Transform Data" in Power Query editor.  Selecting "Add Custom Column".  It's not accepting this new measure. Is this a syntax issue?

Hi @Dbuck44 ,

 

I helped you move your post to the Power Query forum.

And you can add the custom column as follows. It will return the Month number.

 

= Date.Month([Date])

 

vstephenmsft_0-1670229239886.png

And the following will return the month name.

 

= Date.MonthName([Date])

 

vstephenmsft_1-1670229306600.png

And if you also want to return the month number of totay, chech this.

= Date.Month(DateTime.Date(DateTime.LocalNow()))

vstephenmsft_2-1670229489576.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors