Forum Discussion
Sort Week Day Names by Date
Hello,
I need to create a line chart, to show a price change during a week (from Friday to Thursday).
But I am not able to sort WeekDay names BY DATE. The result I get is the following:
What I have done so far:
1) created a column WeeDayName using a formular WeekDayName = FORMAT('Futures'[Дата],"ddd").
2) plotted a WeeDayName on an x-axis and price on a y-axis
3) used necessary dates as a page filter
Please help me! Thank you.
I think I found a bug in PowerBI, if you intitially setup the sort of WEEKDAYNAME to be by WEEKDAYNUM = WEEKDAY([date]) and then change the formula of WEEKDAYNUM = DATEVALUE([date]) it continue to sort correctly on the graph. If you try to sort it by column again then it gives this error. That said, this may not be the best solution so please find another solution below
Put the date on the X Axis and change the format of date to be 'ddd'. Make sure the X axis is changed from Continuous to Categorical. Also if you need to keep the oringinal date column as well you can simply make the WeekDayNum a duplicate of the Date column using = [Date]. Let me know if this works
6 Replies
- moizsherwaniContinued Contributor
You can create a column called "WeekDayNum" using the formula below and Sort "WeekDayName" by WeekDayNum"
WeekDayNum = WEEKDAY('Sample'[Date])- OlegVHelper III
Thank you for a reply, but I need to sort WeekDay names BY DATE, not by Weekday number.
- moizsherwaniContinued Contributor
Instead of using the WEEKDAY function use DATEVALUE function and sort by the same column. Does that get you what you need?
WeekDayNum = DATEVALUE('Sample'[Date])