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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Sort custom text date range on x axis

Hi Everyone,

I've been stuck on this for awhile. I've tried creating a separate calendar table to have the following columns:

  • Date (Based on min and max of my fact table)
  • Month Week Range (a column that shows the week range in terms of the month it's in ie 8/1/2022-8/7/2022
  • Week Num (WeekNum(Calendar[Date])

I've read multiple posts saying to order a custom text date range, i'll need to have another column that I can use in the Sort By Column functionality. I'm just having trouble uniquely identifying these columns in a way that they sort properly. I always get an issue where it says "Cannot sort Month Week Range by Week Num because there can't be more than one value in Week Num for the same value in Month Week Range." I think I understand that there are multiple Week Nums to the Month Week Range, but I'm not sure how to resolve this issue.

 

Incorrect week order:

skedis_1-1660199872738.png

 

Correct week order:

skedis_2-1660199975420.png

 

Many thanks in advance!

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your dataset looks like, but one of ways is to create the sort column by using the date that is mentioned in the front of the range, like the below picture and the attached pbix file.

And then, the range column can be set to be sorted by the Sort column.

 

I suggest creating this in Power Query Editor. The attached file shows how to to this in Power Query Editor.

Please check the attached file.

 

Picture1.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your dataset looks like, but one of ways is to create the sort column by using the date that is mentioned in the front of the range, like the below picture and the attached pbix file.

And then, the range column can be set to be sorted by the Sort column.

 

I suggest creating this in Power Query Editor. The attached file shows how to to this in Power Query Editor.

Please check the attached file.

 

Picture1.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Thank you so much @Jihwan_Kim ! You are not only a super user haha but my super hero. Ty ty.

 

May I ask why you are suggesting to do this in Power Query editor opposed to DAX? 

Hi,

Thank you for your message. 🙂

One of reasons is that if I do this by writing DAX, 

 - I have to extract the date information (or a ranking number information) from the existing range column in order to create a sort column. In this case, the sort column is depending on the range column. I think this may cause circular dependency. I think there is a way not to cause a circular dependency, but in my opinion, the easiest way is to create a sort column in Power Query Editor.

I hope this explains well.

Thank you very much.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors