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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Sorting by Year/Month - Working 50% of the time

 

Much like (seemingly) everyone, I am trying to sort my data by Year/Month. I managed to get a working solution that I can use with 1 set of data (formatted a certain way), but when I use another, almost identical, set of data I get an error.

 

What works:

  1. [Created Date] is a column of dates that, by default, is "24-01-19 12:08:00". In Power Query Editor I set this to type Data and then "Date Only", giving me "24/01/2019".

  2. Back in the Desktop tool, I created a new (calculated?) column with this: CreateDateSort = FORMAT('ICT Tickets - Last 6 Months'[Created Date].[Date],"YYYY mm"). By default this was a TEXT data type and displayed the columns like this:
    Annotation 2019-02-08 105451.jpg

  3. I set this to data type Date and I got this output (which is the desired output):
    Annotation 2019-02-08 102828.jpg

 

What doesn't work

  1. Similarly, I have [Closed Date] which was treated exactly the same way: raw data formatted and extracted to only show the Date.

  2. New column created ClosedDateSort = FORMAT('ICT Tickets - Last 6 Months'[Closed Date].[Date],"YYYY mm"), formatted to type Text:
    Annotation 2019-02-08 110258.jpg

  3. I set this to data type Date and then it breaks. I've tried different Format options and all yield the same:
    Annotation 2019-02-08 110419.jpg

Is there something really obvious I am missing?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Whenever I need to group data within a single month, I just create a "Month" column that uses the StartOfMonth function on whatever Date column i care about (Query editor, add column is the easiest way).  I then format the column to show the date as "MMMM yyyy".

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Whenever I need to group data within a single month, I just create a "Month" column that uses the StartOfMonth function on whatever Date column i care about (Query editor, add column is the easiest way).  I then format the column to show the date as "MMMM yyyy".

 

Anonymous
Not applicable

Legend! That did it. Thanks so much.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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