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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
PBI_newuser
Post Prodigy
Post Prodigy

Create and sort Week Duration by descending order

Hi,

I would like to create a column "Week Duration" start from Sunday to Saturday.

For example:
23-Aug-20 to 29-Aug-20

30-Aug-20 to 05-Sep-20

06-Sep-20 to 12-Sep-20

 

After "Week Duration" column is created, how to sort it by descending order in line chart?

Expected Output:

 

PBI_newuser_0-1613555007919.png

 

1 ACCEPTED SOLUTION

Hi, @PBI_newuser 

You can try the following steps.

 

1 Create a Calculated column

rank_column = RANKX(data,INT(data[Week Start Date]),,DESC,Dense)

 

2 Sort  ‘Week Duration’  column by this column

v-cazheng-msft_0-1614136052077.png

 

The result looks like this:

v-cazheng-msft_1-1614136052080.png

 

Here is the pbix.

 

Best Regards,

Caiyun Zheng

 

 

View solution in original post

6 REPLIES 6
v-cazheng-msft
Community Support
Community Support

Hi, @PBI_newuser 

You can create a column with whole number as its value and then sort your “Week Duration” column with this column. You can refer this article Sort a Column with a Custom Order in Power BI.

 

Best Regards,

Caiyun Zheng

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-cazheng-msft , thanks for your suggestion. But the week duration is continous and updating everyday. How can I create a column with whole number for that? Sample data here.

Hi, @PBI_newuser 

You can try the following steps.

 

1 Create a Calculated column

rank_column = RANKX(data,INT(data[Week Start Date]),,DESC,Dense)

 

2 Sort  ‘Week Duration’  column by this column

v-cazheng-msft_0-1614136052077.png

 

The result looks like this:

v-cazheng-msft_1-1614136052080.png

 

Here is the pbix.

 

Best Regards,

Caiyun Zheng

 

 

Hi @v-cazheng-msft, it works!! Thank you so much for your help! 😉

amitchandak
Super User
Super User

@PBI_newuser ,

if the format is sortable then from three dots you can choose week and Sort descending.

 

Otherwise, create a sort column and mark that as the sort column

refer my video : https://youtu.be/KK1zu4MBb-c

 

or https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak , it doesn't work for my case.

Could you please take a look at my file?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Users online (21,216)