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.
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.
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.- bo_afk6 years agoPost Patron
Hi V-lianl-msft , thanks for your feedback. Initially I used this slicer but it was adding in extra years and months that didn't exist in my data so I was unable to use it.
- V-lianl-msft6 years agoCommunity Support
Hi bo_afk ,
You need to sort "DeliveryMonth" by "DeliveryDate"
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.