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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ericbi
Frequent Visitor

How to sort weeknumber in row?

Hi, 

 

I have table like this 

1.JPG
I would like to have a visualization table like this and the top row sorted by weeknum descending. but BI always sort it ascending. I checked lot of topic but can't find a solution.  the weeknum is in whole number format. 

2.JPG

Thank you. 

1 ACCEPTED SOLUTION

I found that I can sort it in the report after I submitted to the web.  just go to that visualization at right corner and select sort by weeknumber then done.  it's not working in desktop. 

 

thank you everyone. 

View solution in original post

6 REPLIES 6
ccakjcrx
Resolver I
Resolver I

Hey @ericbi!

 

I put your data into an Excel sheet--not power pivot. I then imported the excel sheet into power bi. I then created a matrix with the info, and it appeared as follows by default:

 

Screenshot.jpg

 

 

 

 

 

 

 

 

 

Click HERE if you need to access my .pbix file. 

Hi, 

 

I would like to have the 201803 in the first column, then 201802... etc.  

@ericbi,

Please follow the steps below.

1. Create a conditional column in Query Editor of Power BI Desktop.
1.JPG

2. In report view of Power BI Desktop, click the Week column in your tables, then choose "Sort by column" to sort the Week column by the Custom column(conditional column).
2.JPG

Regards,
Lydia

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

Thank you Lydia. but my report has scheduled refresh,  so the weeknumber will be added automatically, I would like to find a way to sort it by itself.  

 

thanks again. 

Anonymous
Not applicable

Credits to @ipsingh79 in an earlier forum post. I checked his solution and that works:

 

Please check if all weeks are correctly filled like 201801, 201818, etc. This must be correct to let the solution work.

Open Edit Query --> Add custom column as : SortWeek = 999953 - [Week]

Apply and Close the query editor

Sort the original Week column with the custom column "SortWeek"

 

Matrix will be correctly sorted (201803 as first column)

I found that I can sort it in the report after I submitted to the web.  just go to that visualization at right corner and select sort by weeknumber then done.  it's not working in desktop. 

 

thank you everyone. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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