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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Month and Year Sorting

Hi, 

 

This is probably quite an easy one, but can't seem to get it working. 

 

I have a simple table which i've imported from excel with year and month, and i'm trying to get it to sort corrently in my graphs. 

 

I've tried formatting the colums to get a number sort but it says it can't format the text?

 

Thanks for your help

Sonia

 

Capture3.PNG

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

 

Try this

 

  1. Create a sepeate 12 rows * 2 column table.  The first column should have Months and the second one running numbers depicting the order of each month.  So if you Financial year is Jan to Dec, then assign 1 to Jan and 12 to Dec
  2. Create a relationship between the Month column in your base data table to the Month column of the new Table
  3. In the Base data table, Write this formula to bring over the Order from the Table created in 1 above =RELATED(Month_Order[Order]).  Rename this column as Order of month
  4. Click on any cell in the Month column of your data table and go to "Sort by Column" select Order of Month
  5. Drag the Month from the base data table.

Hope this helps.


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

Hi @Ashish_Mathur

 

Thanks for you reply!

 

In another table of mine, I'm trying to sort MonthY by Monthly number , but it won't work ...

 

any ideas?

 

Thanks for your help!

 

Capture11.PNG

 

Capture10.PNG

Hi,

 

Did you follow the steps i outlined above.


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

Hi @Ashish_Mathur

 

Yes, for the original issue I did 🙂

 

For this particular problem, I'm using a date table (which I've linked to my main data), but I'm not sure why it won't sort by the Monthy Number column... 

 

Thanks again

Hi,

 

I cannot say until i see your file.


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

Hi SoniaL,

 

Column will be sorted by the first character because type of date column is text.

 

To achieve your requirement, please refer to the steps below:

 

1.Change type of column [date] with date type in Query Editor.

22.PNG

2.Sort table by column [date] and result is like below.

222.PNG

2222.PNG

 

Best Regards,

Jimmy Tao

Anonymous
Not applicable

Thank you, @v-yuta-msft!

 

 

I was wondering if you might be able to help me with the 2nd problem? For some reason, within my date table, the MonthY column won't sort by the MonthY Number column. 

 

So, when I bring in the MonthY to my graph, it's all jumbled. 

 

Any ideas?

 

Thanks for your help

 

Capture14.PNGCapture11.PNG

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.