Reply
Regular Visitor
Posts: 15
Registered: ‎09-11-2018
Accepted Solution

Sort by another column issue

So currently I am trying to display the date and month in order but get the following:

 

capture.png

 

 I have setup my calendar table as:

 

PROD Calendar =
VAR Days = CALENDAR(MIN('LCP_Contacts'[Visited Date]),MAX('LCP_Contacts'[Visited Date]))
RETURN ADDCOLUMNS(
  Days,
  "Year", YEAR([Date]),
  "Year Sort", 10000 - YEAR([Date]),
  "Month Number", MONTH([Date]),
  "Month", FORMAT([Date],"mmmm"),
  "Month Year Number", YEAR([Date]) * 100 + MONTH([Date]),
  "Month Year Text", FORMAT([Date],"mmm yyyy"),
  "Date Month Number", DAY([Date]) + MONTH([Date]) * 100 + YEAR([Date]) *10000,
  "Date Month Text", FORMAT([Date], "dd mmm"),
  "Fiscal Year", YEAR([Date]+184),
  "Fiscal Year Sort", 10000 - YEAR([Date]+184)
)

 

I have setup the chart with the following details:

capture1.png

 

And have tried selecting the line chart then selecting the field and clicking on Sort by Column:

capture2.pngcapture3.png

 

Does not help and the line chart stays the same.

 

This is what the calendar table looks like:

capture4.png

 

Can anybody provide me with some help as what I am doing wrong here?

 

 


Accepted Solutions
Regular Visitor
Posts: 15
Registered: ‎09-11-2018

Re: Sort by another column issue

I just found a work around by adding the "Date Month Number" field to the Tooltips and then I can sort:

capture7.png

View solution in original post


All Replies
Super User
Posts: 659
Registered: ‎04-02-2017

Re: Sort by another column issue

@tiztrain Can you please check and confirm whether the "Date Month Number" field is "Whole Number" Data Type or not.



Did I answer your question? Click ? and Mark my post as a solution!

Proud to be a Datanaut!





Regular Visitor
Posts: 15
Registered: ‎09-11-2018

Re: Sort by another column issue

capture5.png

 

Sorry forgot to mention that I had checked this

Community Support Team
Posts: 1,392
Registered: ‎07-25-2018

Re: Sort by another column issue

Hi @tiztrain

 

It seems you may try to add another table to set the order. Below is the article for your reference. If it is not your case, please share some data sample and expected output. You can upload it to OneDrive or Dropbox and post the link here.

 

http://www.excelnaccess.com/custom-sorting-in-power-bi/

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Posts: 659
Registered: ‎04-02-2017

Re: Sort by another column issue

@tiztrain Did you tried with this option on the chart.

 

image.png



Did I answer your question? Click ? and Mark my post as a solution!

Proud to be a Datanaut!





Regular Visitor
Posts: 15
Registered: ‎09-11-2018

Re: Sort by another column issue

capture6.png


The chart displays in Date Month Text but I want to sort by the Date Month Number.

 

How can I add this as an option to sort by?

Regular Visitor
Posts: 15
Registered: ‎09-11-2018

Re: Sort by another column issue

I just found a work around by adding the "Date Month Number" field to the Tooltips and then I can sort:

capture7.png

Community Support Team
Posts: 1,392
Registered: ‎07-25-2018

Re: Sort by another column issue

Hi @tiztrain

 

Glad to hear you've solved it, please accept the helpful answer or your solution as solution, that way, other community members will easily find the solution when they get same issue.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regular Visitor
Posts: 15
Registered: ‎09-11-2018

Re: Sort by another column issue

I was still wondering if there is a better way to do it?
Highlighted
Community Support Team
Posts: 1,392
Registered: ‎07-25-2018

Re: Sort by another column issue

Hi @tiztrain

 

Based on my test, it seems there is no better way to do that.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.