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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Tricky Sort

Hi Experts

 

My Dates column in a certain table has mulitple dates - i want to sort the data how is was copy and pasted into the table (enter data) in Power Query.

Date Column

20 April 2021

20 April 2021

20 April 2021

20 April 2021

20 April 2021

20 April 2021

20 April 2021

30 June 2019

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

That's too vague, without understanding what exactly you want to achieve I cannot give a solution.

The index added in Power Query will sort the table in the given order, the fact that a specific columns will also be sorted is just a consequence. This is the way to go if you need the sort for the calculations in M. Also this doesn't impact the table sorting in DAX layer at all.
In the DAX layer the sorting can happen in two levels:

1) in a visual, where e.g. all entries for '20 April 2021' will be grouped to reflect the number of items shown for that date, if that's what you want to sort then you just need custom index per date in the order you expect and use sort by column

2) in the table view, but that doesn't have any implications for the measure/column calculations or visuals, so I doubt this is what you're looking for

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

6 REPLIES 6
Stachu
Community Champion
Community Champion

I would add an index column after the data was pasted, then you use it for sorting purposes and remove afterwards



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

Hi Stachu, try thats but i have multiple date values.....

Stachu
Community Champion
Community Champion

ok, one step back - do you want to sort in Power Query or in the model?



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

Either which method works...

Stachu
Community Champion
Community Champion

That's too vague, without understanding what exactly you want to achieve I cannot give a solution.

The index added in Power Query will sort the table in the given order, the fact that a specific columns will also be sorted is just a consequence. This is the way to go if you need the sort for the calculations in M. Also this doesn't impact the table sorting in DAX layer at all.
In the DAX layer the sorting can happen in two levels:

1) in a visual, where e.g. all entries for '20 April 2021' will be grouped to reflect the number of items shown for that date, if that's what you want to sort then you just need custom index per date in the order you expect and use sort by column

2) in the table view, but that doesn't have any implications for the measure/column calculations or visuals, so I doubt this is what you're looking for

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Anonymous
Not applicable

Thanks - that helped - much appreicated.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors