Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
This might be a pretty simple thing to do but I am fairly new to Power BI and still trying to learn. I have a simple table of tasks and I want to highlight new items. For instance, anything that is posted within 7 days gets highlighted based on the Date reported which I do have within my Data.
| Issue | Type | Date Reported | Date Resolved | Status | Impact | Details |
| Issue1 | Issue | 18.10.2022 | on-going | Impact1 | Impact1 | |
| Issue2 | Issue | 08.10.2022 | 19.10.2022 | on-going | Impact2 | Impact2 |
Solved! Go to Solution.
Hi @Anonymous
I just used your code in the example file I created for you and it highlights in red anything that is more than 7 days in the past
You said you wanted to highlight things posted in the past 7 days, not more than 7 days ago?
To highlight things in the past 7 days you want to use greater than or equal to in the code, the code you posted is using less than or equal to
New = IF(SELECTEDVALUE('Issues'[Date Reported]) <= TODAY()-7, "red")
regards
Phil
Proud to be a Super User!
Hi @Anonymous
Your measure for assigning the color is looking for dates that are greater than or equal to TODAY - 7 days. At time of writing that means it will highlight things from 28 Oct onwards
But in your data the latest date is Oct 24th so that's why nothing is being highlighted.
regards
Phil
Proud to be a Super User!
Hi @Anonymous
I just used your code in the example file I created for you and it highlights in red anything that is more than 7 days in the past
You said you wanted to highlight things posted in the past 7 days, not more than 7 days ago?
To highlight things in the past 7 days you want to use greater than or equal to in the code, the code you posted is using less than or equal to
New = IF(SELECTEDVALUE('Issues'[Date Reported]) <= TODAY()-7, "red")
regards
Phil
Proud to be a Super User!
Hi @Anonymous ,
Please try below steps:
1. create a measure with below dax formula
Measure =
VAR cur_date =
TODAY () - 7
VAR cur_reportdate =
SELECTEDVALUE ( 'Table'[Date Reported] )
RETURN
IF ( cur_reportdate <= cur_date, "red" )
2. set the conditinal format for field background
For more details about , you can read related document: Apply conditional table formatting in Power BI - Power BI | Microsoft Learn
Please refer the attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Download example PBIX file with the code and data below
You can create a measure like this
New = IF(SELECTEDVALUE('DataTable'[Date Reported]) >= TODAY()-7, "#ADD8E6")
which sets a color defined by the HEX code #ADD8E6 (pale blue) and this can be used in a Conditional Formatting rule to change the background color of the cells in the table. Set the HEX code to anything you like
More color codes here https://htmlcolorcodes.com/
After creating the measure, add the CF rule
Using these settings for the rule
Resulting in this
NOTE You have to create a separate CF rule for each column (Value), PBI won't let you set a rule for an entire row.
Regards
Phil
Proud to be a Super User!
with your measure
Hi @Anonymous
So you've created the Conditional Formatting rule after creating the measure?
Without seeing your data and the rule you wrote I can't say for sure what is wrong. Can you supply your file or at least the data (as text or table - not an image) you are running the CF rule against?
regards
Phil
Proud to be a Super User!
Here is the .pbix It didnt allow me to attach here so had to upload somewhere else.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |