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

Sort Graph by Month and Year

Capture.PNG

Hi All,

 

Help needed. Can I have this graph sorted to have (left to right), Jan 2018, Dec 2017, Nov 2017 so on...?

 

Thanks,

Paul

6 REPLIES 6
JordanJSA
Frequent Visitor

Hi Polaris,

 

You could create a new column in your table in the query editor and input the order in which you wish to see the dates by creating an index e.g.
Jan 2018 = 1
Dec 2017 = 2
Nov 2017 = 3

Once you've done that then sort the graph via the index created. But i would advise creating the table oldest date to newest for ease of use. 

good solution, I could solved the same problem thank to your comment. 

Hi Jordan,

 

Actually, the X-axis I used in this graph is from a Date table using the combined fields of month and year.

 

 InsertCalendarMonth = Table.AddColumn(InsertMonthName, "MonthInCalendar", each (try(Text.Range([MonthName],0,3)) otherwise [MonthName]) & " " & Number.ToText([Year])),

 

Can you walk me through on how I can create a new column with index as suggested above?

 

Thanks

Hi Polaris, 

 

Okay, what source did you upload the data from? Excel? 

 

 

Hi  Jordan - not sure what source of what data you're asking.  The Date table was created in PowerBI itself (as a query).  The data is coming from Google sheets. 

 

So, basically I have two tables, one as datasource and a Date table for the calendar.  The X-Axis presented in this graph that I wanted to sort out is using the concatenated Month and Year columns from the Date table.  If I have to create a new column like what you said with Index, which table should I create it? and How?

 

Thanks

 

Hi Polaris, 

 

I've been looking into this and I'm not sure that this can be done within PowerBI. The index feature within PowerBI naturally orders the values 1,2,3.. Which wouldn't return the output you need. An alternative would be to create the index within Google docs if possible and then once loaded into PowerBI you would have the order that you require and you could sort by this value. 

 

thanks 

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.

Top Solution Authors