Forum Discussion
create report sorted by Date Time, but showing Weekday Text and Time on X axis.
I am looking for a way to create a report for the following data Sorted by Date Time, but the x axis shows Weekday + time.
| Reading | Date time | name | Weekday + time |
| 992 | 06/01/20 01:00 AM | widget | Monday 01:00 AM |
| 1084 | 06/01/20 02:00 AM | widget | Monday 02:00 AM |
| 2716 | 06/01/20 03:00 AM | widget | Monday 03:00 AM |
| 2596 | 06/01/20 04:00 AM | widget | Monday 04:00 AM |
| 1049 | 06/02/20 05:00 AM | widget | Tuesday 05:00 AM |
| 1586 | 06/02/20 06:00 AM | widget | Tuesday 06:00 AM |
| 3151 | 06/02/20 07:00 AM | widget | Tuesday 07:00 AM |
| 3169 | 06/02/20 08:00 AM | widget | Tuesday 08:00 AM |
| 2857 | 06/03/20 09:00 AM | widget | Wednesday 09:00 AM |
| 2883 | 06/03/20 10:00 AM | widget | Wednesday 10:00 AM |
| 1537 | 06/03/20 11:00 AM | widget | Wednesday 11:00 AM |
| 1093 | 06/03/20 12:00 PM | widget | Wednesday 12:00 PM |
| 1022 | 06/04/20 01:00 PM | widget | Thursday 1:00 PM |
| 2560 | 06/04/20 02:00 PM | widget | Thursday 2:00 PM |
| 2913 | 06/04/20 03:00 PM | widget | Thursday 3:00 PM |
| 2904 | 06/04/20 04:00 PM | widget | Thursday 4:00 PM |
| 2905 | 06/05/20 05:00 PM | widget | Friday 5:00 PM |
| 1018 | 06/05/20 06:00 PM | widget | Friday 6:00 PM |
| 234 | 06/05/20 07:00 PM | widget | Friday 7:00 PM |
| 1022 | 06/05/20 08:00 PM | widget | Friday 8:00 PM |
And show it in a report like this.
My end goal is to be able to compare the last 2 weeks worth of data by Weekday and time on the same report.
5 Replies
- amitchandak
Super User
moltra , create a column week Day + time. You need to ensure that you can have the correct sort.
Mark that as the sort column for this column weekday name + time
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
Weekday([Date]) //gives week day
format([Date],"DDDD") will give you weekday name
- moltra
Helper IV
amitchandak This works, but for some reason when I try and use the weekday name + time column, it shifts the graph to sort the x axis as text.
Here is how I am getting the weekday name + time column. I think this is what is causing the problem.
weekdaytext = FORMAT('table'[Date],"dddd") & " " & 'table'[Hour]&":00:00"- amitchandak
Super User
weekdaytext = FORMAT('table'[Date],"dddd") & " " & 'table'[Hour]&":00:00"
weekday Sort= weekday('table'[Date]) & " " & 'table'[Hour]&":00:00"
Make the second column as the sort column and then use first in visual /chart
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
- AnonymousNot applicable
HI moltra,
I'd like to suggest you extract these text values and add an index field as sort order, then link to raw table and use new table fields on the original chart to achieve custom sorting.
Reference blog:
Custom Sorting in Power BI
Regards,Xiaoxin Sheng
- moltra
Helper IV
When I add the Day of the week column it does not show the date as a sort method. I think it is cause they are different variable types.
It also messes up the goal lines that I got working on another of my questions on here.