Forum Discussion
Hello Need help with week sorting
Hello, I have created below column and when I am adding it to slicer it is not giving me correct sorting order. how can I fix it?
WeekEnding =
VAR myWeekNum = WEEKNUM([Date])
VAR myYear = YEAR([Date])
VAR myEndDate = CALCULATE(MAX([Date]),FILTER(ALL(DateSlicer),YEAR([Date])=myYear && DateSlicer[WeekNum]=myWeekNum && DateSlicer[WeekDay]=6))
VAR myEndDate1 = IF(NOT(ISBLANK(myEndDate)),myEndDate,CALCULATE(MAX([Date]),FILTER(ALL(DateSlicer),YEAR([Date])=myYear+1 && DateSlicer[WeekNum]=1 && DateSlicer[WeekDay]=6)))
VAR myEndDate2 = IF(NOT(ISBLANK(myEndDate1)),myEndDate1,MAX([Date]))
RETURN " Friday " & myEndDate2
Press on your column where you have put the values for the slicer , you will find in column tools above something called sort column by , pressit and choose by weeksort column this should fix it
5 Replies
- eliasayyyMemorable Member
To sort weeks create a week id
Weekid =
VAR _y = Year(min('table'[Date]))
RETURN
WEEKNUM('table'[Date],2) + (YEAR('table'[Date]) - _min) *53
- davehardikkumarHelper I
I am using slicer and I am using weekending column from above post. how would your column help me to sort weekending column?
- eliasayyyMemorable Member
Can you please show me a sample of th results?