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
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
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.