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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Alex_0201
Post Partisan
Post Partisan

Conditional formatting background_empty cells

Hi,

Need help with conditional formatting. I have a table with activities and statuses (closed/open). So I added this measure (called Measure) but it gives value 2 to blank cells as well:

 

Measure =
SWITCH(MAX([Table]),
"Closed",2,
"Open",1
)
 
                                                                                                   Now
1.PNG
 
So how do I change the Measure so that it leaves blank cells without value and they thefore not colored at all:       
                                                                                                     To be
Capture.PNG
1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @Alex_0201 

 

According to your description, I think you can create a measure, It only judge the two states of open and closed.

like this:

Measure = IF(MAX('Table'[Status])="open","Red",IF(MAX('Table'[Status])="closed","Green"))//Omit blank()

Then use it in condifitional formatting.

Like this:

vjaneygmsft_0-1631167827498.png

vjaneygmsft_1-1631167836678.png


Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hi, @Alex_0201 

 

According to your description, I think you can create a measure, It only judge the two states of open and closed.

like this:

Measure = IF(MAX('Table'[Status])="open","Red",IF(MAX('Table'[Status])="closed","Green"))//Omit blank()

Then use it in condifitional formatting.

Like this:

vjaneygmsft_0-1631167827498.png

vjaneygmsft_1-1631167836678.png


Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

amitchandak
Super User
Super User

@Alex_0201 , Blank cell can not be colored

 

Try this

color measure =

var _1 = coalesce(MAX([Table]), "Closed")

return

SWITCH(_1,
"Closed","Green"
"Open","Red"

)

 

Use this in conditional formatting using field value option
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak, thanks! but I need this measure as an input in conditional formatting for background color of cells thus the values 1 and 2. And with your modification I can not choose the measure in conditional formatting anymore.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.