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
Jolyon
Helper III
Helper III

how to sort Date (MonthYear column)?

Hello,

need urgent help of yours:

 

I have a column Date (e.g. 01.01.2016), then I added columns Month and Year and concatenated them to get the column MonthYear(e.g. January2016):
6.png

 

 

Now the problem is, that I have date from 3 years(2016-2018) and I can not sort them correctly:
5.png


Here I sorted them by Month Number, but as you see, it doesn't work correctly. I can not sort them by column Date either, since I have multiple Date values for one MonthYear value.


So how could I sort MonthYear correctly, so that values Jan2017 and Feb 2017 will be shown after Months of 2016?
Could anyone help?

thanks a lot!

22 REPLIES 22

@tringuyenminh92
hm, it is a bit strange, because I get error message from Power BI, that says : the variation column Month and Year couldn't be found in the table:
7.png

 

Table1 is name of my table; Date is name of my Date column; I have Date in format dd.mm.yyyy.
I tried both German and English in the formula for the Month and Year, but it doesn't work.

And the same problem with YearMonthInt = Dates[Date].[Year]*100 +  Dates[Date].[MonthNo]  --> in my report I get error message.

 

Is DATES in your report the name of your table?

thanks for the help!

Hi @Jolyon,

 

yes, Dates is table name. Please ensure your data type of Date column is Date cause as my observation, i dont think your Date column is in Date type. So it doesnt support additional fields.

If you got problems with casting Date column, you could substring by left or Right method for your Date column and use Value() method to convert text to int.

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.