Forum Discussion
Adding highlight to a column in visual based on date
- 5 years ago
Hi, Anonymous
You may modify the 'Calendar' table as below.
Calendar = ADDCOLUMNS( CALENDARAUTO(), "EndofWeek", var d =[Date] return MAXX( FILTER( CALENDARAUTO(), YEAR([Date])*100+WEEKNUM([Date])=YEAR(d)*100+WEEKNUM(d) ), [Date] ) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Calendar(a calculated table):
Calendar =
ADDCOLUMNS(
CALENDARAUTO(),
"EndofWeek",
var d =[Date]
return
MAXX(
FILTER(
CALENDARAUTO(),
YEAR([Date])*100+WEEKNUM([Date])=YEAR(d)*100+WEEKNUM(d)
),
[Date]
)-1
)
Relationship:
You may create a measure and set conditional format based on the measure as below.
Color Control =
var d = MAX('Calendar'[EndofWeek])
var lastweeknum =
CALCULATE(
MAX('Calendar'[EndofWeek]),
FILTER(
ALL('Calendar'),
[EndofWeek]<
CALCULATE(
MAX('Calendar'[EndofWeek]),
FILTER(
ALL('Calendar'),
[Date]=TODAY()
)
)
)
)
return
IF(
d = lastweeknum,
"red"
)
Result(Today is 3/1/2021):
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
One thing i noticed about that calendar: one of the days is after the after the end-of-week, every week.
- v-alq-msft5 years ago
Community Support
Hi, Anonymous
You may modify the 'Calendar' table as below.
Calendar = ADDCOLUMNS( CALENDARAUTO(), "EndofWeek", var d =[Date] return MAXX( FILTER( CALENDARAUTO(), YEAR([Date])*100+WEEKNUM([Date])=YEAR(d)*100+WEEKNUM(d) ), [Date] ) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.