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 )
tamerj1 ,
I see, but how? 🙂
Formula in Week column is:
Anonymous
Please try
Week =
FORMAT ( 'Calendar'[Date] - WEEKDAY ( 'Calendar'[Date], 2 ) + 1, "dd-MMM" ) & " - "
& FORMAT (
MIN (
'Calendar'[Date] - WEEKDAY ( 'Calendar'[Date], 2 ) + 7,
ENDOFYEAR ( 'Calendar'[Date] )
),
"dd-MMM"
)- tamerj13 years agoCommunity Champion
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 ) - Anonymous3 years agoNot applicable
your solution works tamerj1 and will accept it,
but it creates this short week containing only one day, and I know my colleagues will ask why 😅do you maybe know if it's possible to somehow repeat a value from row above on condition from other column,
like here, I did rankx of Date columnday_rank =RANKX('Calendar','Calendar'[Date],,ASC)
and maybe it's possible to write a logical function ( using REPT, IF, EARLIER) that will check if next row in Week column is equial to previous one, if true, then repeat Day_rank row, if not then Day_rank?thanks for all your help!
- Anonymous3 years agoNot applicable
tamerj1 ,
well the last solution actually works fine, thanks again 🙂