cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

So how do I change the Measure so that it leaves blank cells without value and they thefore not colored at all:
To be
1 ACCEPTED SOLUTION
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:

Best Regards,

Community Support Team _ Janey

3 REPLIES 3
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:

Best Regards,

Community Support Team _ Janey

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
)

Post Partisan

@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.

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors