Forum Discussion
Sorting two date columns
- 6 years ago
Hi V-lianl-msft , I solved it by bringing in the month number directly from the data source, along with the month name. I could then sort the month name by the month number and this looked to solve the issue.
Initially I'd created a month number column within Power BI, based off of the date, and then sort the month name by this column but this didn't work.
Create a month Sort column and mark it as sort column
sort Month = format(date[date],"YYYYMM")
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin
Hi amitchandak , thanks for your suggestion. But when I try to do this, it gives me the error message "this column can't be sorted by a column that is already sorted, directly or indirectly, by column".
I don't remember sorting any other columns by this...but is it possible for me to double-check this?
- amitchandak6 years agoSuper User
Please make sure the sort column is not based on month-year column. Both of them can be based on the same base column-like Date.
- bo_afk6 years agoPost Patron
Hi amitchandak , can you go through the steps again please? It doesn't seem to have worked for me.
I have the following columns:
RaisedDate RaisedYear RaisedMonth DeliveryDate DeliveryYear DeliveryMonth Quantity 2020-01-03 2020 January 2020-03-14 2020 March 250 2020-01-06 2020 January 2020-05-05 2020 May 100 When I create a hierarchy slicer for DeliveryYear and Month, I get the following.
- V-lianl-msft6 years agoCommunity Support
Hi bo_afk ,
There is a visual called "hierarchy slicer" in marketplace. Using this visual and applying the date hierarchy provided by powerbi can meet your needs.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.