Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
RickWelfel
New Member

Table formatting

I have a table that shows data based on date range, is there a way to highlight or bold the date that is in a current week? 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @RickWelfel 

create the measure and put it in Background color of Values you want,

conditional format = 
VAR _today =
    TODAY () // get current date
VAR _oneweekago =LASTDATE(CALCULATETABLE(DATEADD ( 'date'[Date], -7, DAY ),ALL('date')))//get the date one week ago, e.g. today= 2021/6/21, then _oneweekago=2021/6/14
RETURN
    IF (
        MIN ( 'date'[Date] ) >= _oneweekago
            && MIN ( 'date'[Date] ) <= _today,
        "Yellow"
    )

vxiaotang_0-1624257802357.png

vxiaotang_1-1624257840005.png

result:

vxiaotang_2-1624258922307.png

See sample file attached bellow.

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution✔️ to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
RickWelfel
New Member

I was able to get the formula working but giving me a MIN function only accpets a column reference as an argument. 

 

Hi @RickWelfel 

in my sample, 

 MIN ( 'date'[Date] ) 

'date'[Date] is a column.

what do you put in function Min()?😅

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution✔️ to help the other members find it more quickly.

This is what I am trying to state: 

current week =
VAR _today =
TODAY () // get current date
VAR _oneweekago =LASTDATE(CALCULATETABLE(DATEADD ( 'Combined Schedule'[Start].[Date], -7, DAY ),ALL('Combined Schedule'[Start].[Date])))//get the date one week ago, e.g. today= 2021/6/21, then _oneweekago=2021/6/14
RETURN
IF (
MIN ( 'Combined Schedule'[Start].[Date] ) >= _oneweekago
&& MIN ( 'Combined Schedule'[Start].[Date]] ) <= _today,
"Yellow"
)))))))
 
 
 
Now its giving me an error of "The end of the input was reached". 
 

Hi @RickWelfel 

 

vxiaotang_0-1624584359464.png

 

use:

 

current week =
VAR _today =
    TODAY ()
VAR _oneweekago =
    LASTDATE (
        CALCULATETABLE (
            DATEADD ( 'Combined Schedule'[Start].[Date], -7, DAY ),
            ALL ( 'Combined Schedule' )
        )
    )
RETURN
    IF (
        MIN ( 'Combined Schedule'[Start].[Date] ) >= _oneweekago
            && MIN ( 'Combined Schedule'[Start].[Date] ) <= _today,
        "Yellow"
    )

 

FYI:

https://docs.microsoft.com/en-us/dax/all-function-dax

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution✔️ to help the other members find it more quickly.

v-xiaotang
Community Support
Community Support

Hi @RickWelfel 

create the measure and put it in Background color of Values you want,

conditional format = 
VAR _today =
    TODAY () // get current date
VAR _oneweekago =LASTDATE(CALCULATETABLE(DATEADD ( 'date'[Date], -7, DAY ),ALL('date')))//get the date one week ago, e.g. today= 2021/6/21, then _oneweekago=2021/6/14
RETURN
    IF (
        MIN ( 'date'[Date] ) >= _oneweekago
            && MIN ( 'date'[Date] ) <= _today,
        "Yellow"
    )

vxiaotang_0-1624257802357.png

vxiaotang_1-1624257840005.png

result:

vxiaotang_2-1624258922307.png

See sample file attached bellow.

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution✔️ to help the other members find it more quickly.

Thanks for the help. I am still having issues with typing VAR_Today,  this is giving me an error. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.