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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

extracting the month from a date field

Hi

I have a field that contains dates and want to just take out the month so I can plot a series of data points against that single month value instead of a range of date. Is there a function/measure/dax that will look at the date and return just the month value from it?

THanks!

Paul

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

Try:

MONTH([date])

This will give you the month NUMBER (e.g. Jan = 1, Feb = 2 etc.).

If you want this to be more user-friendly, you could add a SWITCH(), something like this:

MyMonth =
SWITCH(
    TRUE(),
    MONTH([date]) = 1, "Jan",
    MONTH([date]) = 2, "Feb"... etc.

 

Good luck



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @Anonymous ,

Try:

MONTH([date])

This will give you the month NUMBER (e.g. Jan = 1, Feb = 2 etc.).

If you want this to be more user-friendly, you could add a SWITCH(), something like this:

MyMonth =
SWITCH(
    TRUE(),
    MONTH([date]) = 1, "Jan",
    MONTH([date]) = 2, "Feb"... etc.

 

Good luck



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




az38
Community Champion
Community Champion

@Anonymous @BA_Pete 

🙂

or you can get month name by 

Column =[Date].[Month]

or

Column = FORMAT([Date], "mmm")

or

Column = FORMAT([Date], "mmmm")

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Ah, yes. Do what @az38 said. Way tidier.

@Anonymous 



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors