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

Calendar Sorting Problem

I previously had a problem trying to get my data to sort correctly based on one field while displaying another field in the line graph widget

https://community.powerbi.com/t5/Desktop/Sort-by-another-column-issue/m-p/550420#M258958

 

I was able to figure out that by adding the field I wanted to sort by into the Tooltips, I was able to sort the chart correctly.

 

The issue that I have now is when I try to sort by the field Month Year Number (which has also been added to the tooltips), it does not display in order.

 

 capture1.png

 

capture2.png

 

My calendar is still:

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)
)

 

My calendar table still looks correct to me:

capture3.png

 

By hovering over the data to see the tooltip I have realised that BI sums the table together in this chart:

capture4.png

 

capture5.png

 

But on my previous chart from my original post, the field in the tooltips does not get added together:

capture6.png

 

I am a bit lost to what the difference is?


Accepted Solutions
Community Support Team
Posts: 7,483
Registered: ‎08-14-2016

Re: Calendar Sorting Problem

Hi @tiztrain,

 

You can refer to following blog to know how to create a custom sort table with 'sort by column' feature to manually apply sort order of specific column:

Custom Sorting in Power BI

 

Regards,

Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |

View solution in original post


All Replies
Super User
Posts: 596
Registered: ‎02-17-2016

Re: Calendar Sorting Problem

Hi @tiztrain,

 

 

Did you try sorting the MonthYearText column by MonthNumber.

 

 

Cheers

 

CheenuSing

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

Re: Calendar Sorting Problem

Yes I did.

 

As I highlighted in the original post, Sort by Column in the Modeling tab did not work.

 capture7.png

 

The only way to get it to work with my other chart was to add the field in the tooltip section and then sort by

capture1.png

Community Support Team
Posts: 7,483
Registered: ‎08-14-2016

Re: Calendar Sorting Problem

Hi @tiztrain,

 

You can refer to following blog to know how to create a custom sort table with 'sort by column' feature to manually apply sort order of specific column:

Custom Sorting in Power BI

 

Regards,

Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |
Regular Visitor
Posts: 15
Registered: ‎09-11-2018

Re: Calendar Sorting Problem

Argh legend!

I had everything setup correctly but the part I was missing was:

 

Now Exit the Query Editor>>>Go to DATA view >>>Select the ITEMS column in the New Table>>Go to Modelling Tab>>Sort by Column>>Select Index

 

Thank you!