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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
manojk_pbi
Helper IV
Helper IV

Need help in writing logic for color coding either in measure or with additional calculated column

Hi Friends,

 

I have one complex requirement to add background color coding in table. I am not sure what is the better option to implement and how this can be achieved. I am seeking for experts advice on this. Your suggestions will be much appreciated. 

Below i have provided the sample table and the logic to be used for color coding.

Logic for color coding : Any milestone date falling between (today-20) days and (today+20) days need be colored
Blue: for upcoming Milestone dates

Green: Completed milestone
Red: Date is missing

manojk_pbi_0-1718681273828.png

 

DivProjectsMilestoneStatusM0-ActualDateM1-Actual DateM2-ActualDateM3-ActualDateLogic
DIV1PRJ1M010-Apr-2410-Jul-2410-Sep-2410-Dec-24Current status of the project is M0, means completed Milestone 0 on 10th Apr 24 and upcoming (M1) is on 10-Jul-24. M1 date is within the range of reporting period so the color is blue.
DIV1PRJ2M010-Jun-2410-Jul-2410-Sep-2410-Dec-24Current status of the project is M0, means completed Milestone 0 on 10th Jun 24 and upcoming (M1) is on 10-Jul-24. M0 & M1 date is within the range of reporting period so both will be higlighted. Since M0 is completed marked in Green & M1 is upcoming marked in Blue
DIV1PRJ3M110-Nov-2310-Feb-2410-Sep-2410-Dec-24No dates falling in the reporting range, so no color coding
DIV1PRJ4M210-Nov-2310-Feb-2410-Jun-24 Current status of the project is M2, means completed Milestone 2 on 10th Jul 24 and upcoming (M3) has no date defined. So marked in red.

 

1 ACCEPTED SOLUTION

4 REPLIES 4
manojk_pbi
Helper IV
Helper IV

@lbendlin , thanks for the sample. It helps me to understand and build the similar logic in my application. In case of any queries i will reach out to you.

 

lbendlin
Super User
Super User

July 10 is more than 20 days out.

 

To report on things that are not there (your missing date) you need to use disconnected tables and/or crossjoins

 

lbendlin_1-1718717323993.png

 

 

Thanks for your quick response. Pls can you share me the pbix file, will try to understand the concept.

I am still into learning phase of PBI development.

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.