cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
User19 Frequent Visitor
Frequent Visitor

Sorting by month name for Date Hierarchy in DirectQuery

Hi guys,

 

I do know date hierarchy is not available for DirectQuery as of now.

 

However I created a custom DateDim table with different columns like (Date, Year, Quarter, MonthNumber, MonthNames etc.)

 

I joined my date field with the date field in DateDim table. It shows data fine, However when I drill down the data to Month it starts from April, August etc.. till September in Alphabetical order rather than chronological order. The sorting changes when it's drilled down so can't keep default sorting on single column in hierarchy.

 

Please let me know if there are any options for this.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Steve_Wheeler Established Member
Established Member

Re: Sorting by month name for Date Hierarchy in DirectQuery

@User19,

I can't quite see what your issue is from your description.  Per http://databear.com/2016/04/23/power-bi-tips-sort-by-month-name/, you add the Month number column via Power Query editor (i.e. "Edit Query"), but the sort itself is set in the report editor under the Modelling tab - the sort doesn't happen in "Edit Query"?

 

 

View solution in original post

9 REPLIES 9
wiki Frequent Visitor
Frequent Visitor

Re: Sorting by month name for Date Hierarchy in DirectQuery

May be you could create a new column  as shown below in DimDate and sort your month column by the new column.

 

sortMonthYear = 'DimDate'[Month]  + ('DimDate'[Year] * 12)  

 

  

Steve_Wheeler Established Member
Established Member

Re: Sorting by month name for Date Hierarchy in DirectQuery

Baskar Super Contributor
Super Contributor

Re: Sorting by month name for Date Hierarchy in DirectQuery

Yes u r correct .

 

If it is default Hierarchy it will short fine.

 

If u create any custom hierarchy u have to create short order for all level. so here u have to create one more extra column for month. and apply that column to month short.

 

like Example :

 

Switch (Month,"Jan",1,"Feb",2, etc...) 

 

 

let me know if any help

User19 Frequent Visitor
Frequent Visitor

Re: Sorting by month name for Date Hierarchy in DirectQuery

@Baskar@Steve_Wheeler@wikiAppreciate your replies.

 

I am using DirectQuery to create dynamical hierarchy. The sorting in Edit Query has no affect on dimension when used in visual .

Steve_Wheeler Established Member
Established Member

Re: Sorting by month name for Date Hierarchy in DirectQuery

@User19,

I can't quite see what your issue is from your description.  Per http://databear.com/2016/04/23/power-bi-tips-sort-by-month-name/, you add the Month number column via Power Query editor (i.e. "Edit Query"), but the sort itself is set in the report editor under the Modelling tab - the sort doesn't happen in "Edit Query"?

 

 

View solution in original post

User19 Frequent Visitor
Frequent Visitor

Re: Sorting by month name for Date Hierarchy in DirectQuery

@Steve_WheelerThanks for your reply. "Sort By Column" is disabled for me. I am using DirectQuery. 

User19 Frequent Visitor
Frequent Visitor

Re: Sorting by month name for Date Hierarchy in DirectQuery

@Steve_WheelerSorry, I see that now. I will try it and let you know if it works.

User19 Frequent Visitor
Frequent Visitor

Re: Sorting by month name for Date Hierarchy in DirectQuery

Hi everyone, thanks for your replies.

 

The issue was I did not know how and from where to apply sort to a column in Direct Query mode. 

edejes2
Advisor

Re: Sorting by month name for Date Hierarchy in DirectQuery

Hello, 

 

I created this video hope this is the solution you are looking for https://youtu.be/n_gnuFS8qoY

 

Regards!

Erich Dejesus

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (4,419)