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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
JustinDoh1
Post Prodigy
Post Prodigy

Conditional formatting in Matrix's value

Hi community,

 

I am sharing my Pbix file here.

 

I am trying to apply different Background colors on Matrix.

Here is my demo:

JustinDoh1_0-1647981920652.png

 

Currently, this Matrix has two parts.

Left side is Actual and right three columns are Estimate based on logic.

JustinDoh1_1-1647982058553.png

 

When I try to do the Conditional formating on the Value, it does not give me an option to choose either "Actual" or "Estimate".

It only gives me an option of Count and Distinct Count.

JustinDoh1_3-1647982327835.png

 

JustinDoh1_2-1647982205252.png

What I am trying to do is apply different background colors on Value depedning output of BudgetType is "Actual" or "Estimte".

How do we go about doing it with current model?

 

Thank you.

 

 

 

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@JustinDoh1 

You can write a measure to check on the BudgetType[ActualOrEstimated] and return a color string like this.

 

Value Format = 
VAR _Type = SELECTEDVALUE ( BudgetType[ActualOrEstimated] )
RETURN
SWITCH ( 
    TRUE (),
    _Type = "Actual", "Green",
    _Type = "Estimate", "Red"
)

 

Then apply conditional formatting to the Values background based on the Field value of the measure:

jdbuchanan71_0-1647983196758.png

jdbuchanan71_1-1647983218197.png

 

You can use color hex values instead also.

Value Format = 
VAR _Type = SELECTEDVALUE ( BudgetType[ActualOrEstimated] )
RETURN
SWITCH ( 
    TRUE (),
    _Type = "Actual", "#34A853",
    _Type = "Estimate", "#EA4335"
)

 

 

 

View solution in original post

2 REPLIES 2
JustinDoh1
Post Prodigy
Post Prodigy

@jdbuchanan71 Excellent! Thank you!

jdbuchanan71
Super User
Super User

@JustinDoh1 

You can write a measure to check on the BudgetType[ActualOrEstimated] and return a color string like this.

 

Value Format = 
VAR _Type = SELECTEDVALUE ( BudgetType[ActualOrEstimated] )
RETURN
SWITCH ( 
    TRUE (),
    _Type = "Actual", "Green",
    _Type = "Estimate", "Red"
)

 

Then apply conditional formatting to the Values background based on the Field value of the measure:

jdbuchanan71_0-1647983196758.png

jdbuchanan71_1-1647983218197.png

 

You can use color hex values instead also.

Value Format = 
VAR _Type = SELECTEDVALUE ( BudgetType[ActualOrEstimated] )
RETURN
SWITCH ( 
    TRUE (),
    _Type = "Actual", "#34A853",
    _Type = "Estimate", "#EA4335"
)

 

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors