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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to create a conditional color for each event on a calendar?

Hello everyone,
I'm trying to create a kind of safety cross, informing the days of the current month, and the color green if there was no accident in that day, red if there was an accident and white for future days. Something like that:

cross.png

 

 

 

 

 

 

 

 

My accident table has this structure:

DateHourDescription
01/13/202017:30:00example
03/08/202013:30:00example
06/29/202003:40:00example


The table only shows the days that had accidents. Any other day that is not in the table, it means that there was no accident.

I tried to create correlated tables, creating a CALENDAR table and linking it with the data column of the accident table, but I couldn't move forward.

Can someone help me?

1 ACCEPTED SOLUTION
nvprasad
Solution Sage
Solution Sage

Hi,

I have created date table and established a relationship and used date from the date table in the visual. I have used the below measure in conditional formatting to apply color where there are some accidents. 

 

conditional_check =
CALCULATE (
COUNTROWS ( Accidents ),
FILTER ( Accidents, SELECTEDVALUE ( Calander[Date] ) = Accidents[Date] ))

 

Add conditional formatting logic where the measure value is higher than 0.

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

 

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos.
Follow me on LinkedIn.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

Create a relationship between tables.

2.PNG

Then create a measure as below.

Measure = IF(SELECTEDVALUE('CALENDAR'[Date])>TODAY(),0,IF(SELECTEDVALUE('CALENDAR'[Date])=SELECTEDVALUE('Table'[Date]),1,2))

At last create conditional formatting.

3.PNG

Result would be shown as below.

4.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

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

nvprasad
Solution Sage
Solution Sage

Hi,

I have created date table and established a relationship and used date from the date table in the visual. I have used the below measure in conditional formatting to apply color where there are some accidents. 

 

conditional_check =
CALCULATE (
COUNTROWS ( Accidents ),
FILTER ( Accidents, SELECTEDVALUE ( Calander[Date] ) = Accidents[Date] ))

 

Add conditional formatting logic where the measure value is higher than 0.

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

 

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos.
Follow me on LinkedIn.

Hi! there is some kind of a step-by-step way to do it please? i tried to do as you said but couldn't move foward..

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors