Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a table where I am trying to create a coloumn with values from 1 to 7 based on monday to sunday and where the latest date is 1 and the day before that = 2 and so on
I have used the following calculation to create this but its not doing what im expecting. Im not sure why Sat is showing as -4 rather than 3
Any help would be appraciated
Solved! Go to Solution.
Hi @Mishelski
Try this code to add your column:
DOW sort flag =
VAR _daycheck =
WEEKDAY ( TODAY (), 2 )
RETURN
IF (
DIM_WEEKDAY_sort[WEEKDAY] >= _daycheck,
7 - ( DIM_WEEKDAY_sort[WEEKDAY] - _daycheck ),
_daycheck - DIM_WEEKDAY_sort[WEEKDAY]
)
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Hi @Mishelski
Try this code to add your column:
DOW sort flag =
VAR _daycheck =
WEEKDAY ( TODAY (), 2 )
RETURN
IF (
DIM_WEEKDAY_sort[WEEKDAY] >= _daycheck,
7 - ( DIM_WEEKDAY_sort[WEEKDAY] - _daycheck ),
_daycheck - DIM_WEEKDAY_sort[WEEKDAY]
)
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Thank you so much! This has worked perfectly! Really appreciate it!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 6 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 10 | |
| 10 | |
| 8 | |
| 8 |