Forum Discussion
Uzi2019
3 years agoCommunity Champion
Sort week column by multiple values in date
Hi Expert, I have Date, Start Week, End Week, and Week columns. I want to sort my week column based on date or start week column but because of multiple values in date column I cant sort it. ...
Anonymous
3 years agoNot applicable
okay, follow below steps
Create a new calculated column in your data model that calculates the minimum or maximum date for each week. For example, if you want to use the minimum date, you can use the following formula:
DAX
- MinDate = CALCULATE(MIN('YourTable'[Date]), ALLEXCEPT('YourTable', 'YourTable'[Week]))
This formula calculates the minimum date within each week, considering only the rows that have the same Week value as the current row.
Once you have the new calculated column (e.g., MinDate), go to your table visualization and select the Week column.
In the "Modeling" tab of the Power BI ribbon, click on the "Sort ascending" or "Sort descending" button to sort the Week column based on the MinDate column you just created.