Forum Discussion
Anonymous
3 years agoNot applicable
Week sort
Hi all! please help me with the following, I have a column Week , which contains begging and end of week, I was planning to sort it by date, but power bi returns an error "Sort by another co...
- 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 )
Anonymous
3 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?
tamerj1
3 years agoCommunity Champion
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"
)