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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

highlight actual date greater than forecasted date in a table

Hello,

 

I am fairly new to power bi, I am trying to create a conditional formatting rule in power bi where, if a date is less than another date in another column, then the cell gets highlighted in the table:

 

This is what I want my table visual to look like:

 

project idforecasted dateactual datemeasure
1234Aug 21, 20 0
1345  0
1654Feb 28, 21May 10, 20181
1364Aug 10, 16June 18, 200
1476 Dec 31, 190

 

I created a measure that looks like this:

Measure = SWITCH(
    TRUE(),
    Table1[Forecasted Date]>ReportView[Actual Date],0,
    Table1[Forecasted Date]<ReportView[Actual Date],1,
    0)

the problem is, I know my measure is wrong because it is not taking into account the blank fields, I created the measure because I thought I could just do a simple conditional format based on this measure to highlight the actual date field where anything greater than 0 will be highlighted, but I am having a hard time with this. If someone could please help me figure this out, that would be much appreciated. Thank you! 
1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please new a measure like:

Measure = 
IF(
    MAX(Table1[actual date])<MAX(Table1[forecasted date])
    && NOT ISBLANK(MAX('Table1'[actual date])),
    "Red"
)

Then select the table visual --> Visual--> Cell elements --> Apply settings to [forecasted date]-->font color 

vcgaomsft_1-1671516181486.png

 

vcgaomsft_0-1671516125446.png

result:

vcgaomsft_2-1671516333316.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

6 REPLIES 6
v-cgao-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please new a measure like:

Measure = 
IF(
    MAX(Table1[actual date])<MAX(Table1[forecasted date])
    && NOT ISBLANK(MAX('Table1'[actual date])),
    "Red"
)

Then select the table visual --> Visual--> Cell elements --> Apply settings to [forecasted date]-->font color 

vcgaomsft_1-1671516181486.png

 

vcgaomsft_0-1671516125446.png

result:

vcgaomsft_2-1671516333316.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Anonymous
Not applicable

@v-cgao-msft  thank you! worked perfectly 🙂

vicky_
Super User
Super User

You can probably modify your switch statement to include another condition for NOT(ISBLANK(Table1[Forecasted Date]))

Anonymous
Not applicable

@vicky_  sorry how would that look like?

I think something like this?

Measure = SWITCH(
    TRUE(),
    Table1[Forecasted Date]>ReportView[Actual Date],0,
    Table1[Forecasted Date]<ReportView[Actual Date] &&  NOT(ISBLANK(Table1[Forecasted Date])),1,
    0)
Anonymous
Not applicable

@vicky_  thank you 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.