Forum Discussion
Week sort
- 3 years ago
Anonymous
You are digging in the wrong location. When to stop repeating? That brings you back to the original problem of ranking using the correct granularity. This is an infinite loop and will lead to nowhere.The issue is that your business logic wasn't clarified so I had to guess. You can achieve this using
day_rank = RANKX ( 'Calendar', 'Calendar'[Date] - WEEKDAY ( 'Calendar'[Date], 2 ), ASC, DENSE )
hi tamerj1 ,
thanks for your quick response!
sorry, I forgot to mention, that won't work coz Week is a text values, and ranking it doesn't give correct (compared to date) result, as you can see here, 14th week of April 2019 is ranked 1st , even though, there are weeks before it
Anonymous
Aha. Then please try
day_rank =
RANKX (
'Calendar',
VALUE ( SUBSTITUTE ( 'Calendar'[Week_Sort], "_", "" ) ),
ASC,
Dense
)- Anonymous3 years agoNot applicable
- tamerj13 years agoCommunity Champion
Anonymous
These are in two different years. The week sort says one is the last week of 2018 and the other is the first week 2019. You shuld fix the week sort column, either to consider these 7 days as the last week of 2018 or to consider then as the first week of 2019. I mean week and week sort must be alligned.- Anonymous3 years agoNot applicable
tamerj1 ,
I see, but how? 🙂
Formula in Week column is:
Week =FORMAT('Calendar'[Date] - WEEKDAY('Calendar'[Date],2)+1,"dd-MMM")&" - "&FORMAT('Calendar'[Date] - WEEKDAY('Calendar'[Date],2)+7,"dd-MMM")and it's automatically catches those days, it there a way to limit which days fall into which week?