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

How to order month on a table?

Hi guys,

 

I'm trying to model my month table so it will appear in my table correctly, but it's doing alphabetically.

Can anyone give a hand? I wanna order by year and month.

P.S. I did the sort by column and gave a numeric column as reference, but it's not the correct order

image.PNG

 

thanks!

1 ACCEPTED SOLUTION

Hi,

 

I just removed the Acidentes column and added it back.  It worked fine.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

10 REPLIES 10
Phil_Seamark
Employee
Employee

Hi @Anonymous

 

You need to use the "Sort by column" feature to force the sort order of your months to be based on a numeric column.

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Hi, Phil.

 

I did that, but it is giving me that result you see on the image. Only the year 2010 (October - December) is right, all the others are in the wrong order.

Hi @Anonymous

 

Does the column you are sorting by contain both the year and month as part of it?  eg,

 

YYYYMM

 

or 

 

201001

201002

201003

etc

 


You can generate this using the format command, eg, = FORMAT([date col],"YYYYMM")


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Hi Phil

so I created the new YM column, but when I click on my Month name column and sort by YM, it gives me this error: There can't be more than one value in YM column for the same value in Month Name.

 

Any ideia why?

Hi @Anonymous,

 

Can u create a new column (month order column) like (if January = 1, February = 2... and do so..) ?

 

After that try to sort by this new column.

 

I hope it helps you.

 

 

Anonymous
Not applicable

Hi @ricardocamargos, I did that before didn't work tough

 

But thanks.

Hi,

 

I just removed the Acidentes column and added it back.  It worked fine.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you @Ashish_Mathur.  It worked. Happy to learn this trick.

Probably because there is some weird overlap?

 

Any chance you can send a cut down version of your PBIX File?  maybe make a copy, delete any non-essential tables and send it through so we can take a look


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

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.