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
VenkateshV
New Member

How to do conditional formatting to card visuals based on the Date condition and Other measure value

Attached picture has the details of the report layout based on the sample data.

I have to apply the conditional formating based on the EmployeeDOJ and GoalMetrics columns.

 

EmpDOJ is equql to current month.So it should be YELLOW in color.No 'Goal Metrics' applied
EmpDOJ is less than current month i.e joined before current month So 'GoalMetrics' to be applied and it should be GREEN if the 'GoalMetrics' is >=3
EmpDOJ is less than current month i.e joined before current month So 'GoalMetrics' to be applied and it should be RED if the 'GoalMetrics' is =<3
All the metrics for the future months in that Fiscal year has to be 'GREY' in color with no values inside
Anyone can explain how this can be achieved in Power BI report. Thanks.Metrics reports information.JPG

1 ACCEPTED SOLUTION
v-yetao1-msft
Community Support
Community Support

Hi @VenkateshV 

Create a measure like this :

Measure=SWITCH(TRUE(),MONTH(SELECTEDVALUE('Table'[EmpDOJ]))=MONTH(TODAY()),"Yellow",
MONTH(SELECTEDVALUE('Table'[EmpDOJ]))<MONTH(TODAY()) && SELECTEDVALUE('Table'[GoalMetrics])>=3,
"Green",MONTH(SELECTEDVALUE('Table'[EmpDOJ]))<MONTH(TODAY()) && SELECTEDVALUE('Table'[GoalMetrics])<3,"Red","Grey")

Then in Matrix visual Format ,choose the field that need condition formatting and turn on the Background color . Select Field value in Format by ,Measure in Based on field in the pop-up setting box .

Ailsamsft_0-1630045446280.pngAilsamsft_1-1630045446283.png

The final result is as shown :

Ailsamsft_2-1630045446283.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

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

View solution in original post

2 REPLIES 2
v-yetao1-msft
Community Support
Community Support

Hi @VenkateshV 

Create a measure like this :

Measure=SWITCH(TRUE(),MONTH(SELECTEDVALUE('Table'[EmpDOJ]))=MONTH(TODAY()),"Yellow",
MONTH(SELECTEDVALUE('Table'[EmpDOJ]))<MONTH(TODAY()) && SELECTEDVALUE('Table'[GoalMetrics])>=3,
"Green",MONTH(SELECTEDVALUE('Table'[EmpDOJ]))<MONTH(TODAY()) && SELECTEDVALUE('Table'[GoalMetrics])<3,"Red","Grey")

Then in Matrix visual Format ,choose the field that need condition formatting and turn on the Background color . Select Field value in Format by ,Measure in Based on field in the pop-up setting box .

Ailsamsft_0-1630045446280.pngAilsamsft_1-1630045446283.png

The final result is as shown :

Ailsamsft_2-1630045446283.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

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

amitchandak
Super User
Super User

@VenkateshV , You can create a color measure like this and use that in conditional formatting using field value option

 

Switch(True() ,

eomonth(Max(Table[EmpDOJ ]),0) < eomonth(today(),-3)+1 , "Red"

eomonth(Max(Table[EmpDOJ ]),0) < eomonth(today(),-1) +1 , "Green"

eomonth(Max(Table[EmpDOJ ]),0) = eomonth(today(),0) , "Yellow"

 

)

 

refer

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

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.