Skip to main content

Power BI

Completed

Power Query, convert date fields to monthname, weekdayname, quartername

Vote (67) Share
Terje Fjeldstad's profile image

Terje Fjeldstad on 08 May 2015 00:21:57

When using power Query to add columns based on A date field, it would be Nice to also be able to convert to month name, not just month number. Example; 31.01.2012 should have built-in function to set december or dec....monday or mon. Till now, we can only get numeric values.

Administrator on 02 Jul 2016 00:11:43

I'm glad to report that this transformation is now available in the June Update of Power BI Desktop: https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-june-update/ Extract Week Day and Month Name from a DateTime column Another very common customer request has been to provide a built-in transformation to extract the WeekDay or Month names from a given Date/Time column. We’ve made this available from the Query Editor ribbon (either via Transform to modify an existing column, or via Add Column to insert a new one). These two options can be found under “Date -> Day -> Name of Day” and “Date -> Month -> Name of Month”, respectively. Note that the Day/Month names are localized according to the Locale setting for your Power BI Desktop file (available under File -> Options -> Current File -> Regional Settings).

Comments (23)
Terje Fjeldstad's profile image Profile Picture

9c8f60bd 97a3-4a1b-b29d-d78c5f0c91bb on 05 Jul 2020 22:45:40

RE: Power Query, convert date fields to monthname, weekdayname, quartername

Well doesnt work for me when I use DirectQuery with Redshift.

Terje Fjeldstad's profile image Profile Picture

9458cd17 14d9-473e-8379-0c58dbda7997 on 05 Jul 2020 22:34:22

RE: Power Query, convert date fields to monthname, weekdayname, quartername

Is there a plan rather than just creating text fields out of dates, format the dates with custom formats, so they are still sortable as a date/ time field. For example would like to format the field as "ddd dd mmm h:mm AM/PM", which is possible in excel. This may be wrong discussion thread but other comments have indicated the same kind of issue, Thanks

Terje Fjeldstad's profile image Profile Picture

e0129853 bede-4929-9faf-521b48fc15f1 on 05 Jul 2020 22:33:18

RE: Power Query, convert date fields to monthname, weekdayname, quartername

Hello, how can we sort the Months chronologically by name not by number? Can you please assist?

Terje Fjeldstad's profile image Profile Picture

8cf47a51 92a7-ea11-a812-000d3a579c34 on 05 Jul 2020 22:32:36

RE: Power Query, convert date fields to monthname, weekdayname, quartername

I have a 7 digit julian date like 2456839 ....how easy is to covert that in Sydney time (Australia) using Power Bi Desktop?

Terje Fjeldstad's profile image Profile Picture

c1cfc813 dd11-4981-a882-4294c80772f8 on 05 Jul 2020 22:26:55

RE: Power Query, convert date fields to monthname, weekdayname, quartername

This feature does not work in Directquery mode. Will there be an update to allow it?

Terje Fjeldstad's profile image Profile Picture

34f210d5 ae90-45bb-92ab-a636073082ce on 05 Jul 2020 22:26:31

RE: Power Query, convert date fields to monthname, weekdayname, quartername

If you want to sort by month in the slicer you can try this

Month = MONTH([date]) &"-"& format([date],"mmmm")

Will give you 1-January etc.

Terje Fjeldstad's profile image Profile Picture

3e87b645 8331-4103-a467-b09ab1d28fe6 on 05 Jul 2020 22:25:09

RE: Power Query, convert date fields to monthname, weekdayname, quartername

you can access weekday's name in query editor environment, then using Date, Day, Name of the day

Terje Fjeldstad's profile image Profile Picture

735f0507 9f36-4538-b5d1-db5e15b8207f on 05 Jul 2020 22:25:07

RE: Power Query, convert date fields to monthname, weekdayname, quartername

Where exactly is this functionality? I just downloaded the latest version and the weekday formula still returns a number and not the name.

Terje Fjeldstad's profile image Profile Picture

3e87b645 8331-4103-a467-b09ab1d28fe6 on 05 Jul 2020 22:25:05

RE: Power Query, convert date fields to monthname, weekdayname, quartername

Hi Admin,
thanks for the update,it's very handy, is there any chance to sort the months name by calendar not alphabetically?
in particular, I need that when I use Slicer.

Terje Fjeldstad's profile image Profile Picture

8b261ff2 1231-4b56-8300-359c231de0a9 on 05 Jul 2020 22:20:57

RE: Power Query, convert date fields to monthname, weekdayname, quartername

'use this to just show month name of date data
=FORMAT([date to format], "mmmm").
But if you do this, you can't order it by month.
If you try to order it, i'll be orderd alphabetically.
I hope, next version of power BI will accomodate Month Data with sort capability.