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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.