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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Highlighting new items

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.

 

IssueTypeDate ReportedDate ResolvedStatusImpactDetails
Issue1Issue18.10.2022 on-goingImpact1Impact1
Issue2Issue08.10.202219.10.2022on-goingImpact2Impact2

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
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 

cfred.png

 

Check example PBIX file

 

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

7 REPLIES 7
PhilipTreacy
Super User
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.

date-reported.png

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
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 

cfred.png

 

Check example PBIX file

 

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

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

vbinbinyumsft_0-1667442997581.png

vbinbinyumsft_1-1667443015649.png

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.

PhilipTreacy
Super User
Super User

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

cform1.png

 

 

Using these settings for the rule

cform2.png

 

Resulting in this

cform4.png

 

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

 

 

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

with your measure 

New = IF(SELECTEDVALUE('Issues'[Date Reported]) <= TODAY()-7, "red") and steps you provided It doesn't highlight anything. It needs to highlight the past 7 day's period

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



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

Here is the .pbix It didnt allow me to attach here so had to upload somewhere else.

 

https://wetransfer.com/downloads/3c6e2982ea67ea569db88ee905e87ae520221104005049/f54b3c8d9dfaa6edad10...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.