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
kp_wood13
Helper I
Helper I

Conditional Format Based on Two Columns

I've been searching the community for how to handle this but not been successful with what I've found so far. I'm trying to update conditional formatting so that if the stage is Initiate or Plan and Implementation Dates, Funding Dates, Cost Plan, and Budget Plan are "N" then the background color is blank but if they're "Y" the background color is green. Any suggestions?

 

kp_wood13_0-1703169551702.png

 

1 ACCEPTED SOLUTION
kp_wood13
Helper I
Helper I

For what it's worth I found a solution in this post. Rather than just looking at the two stages I'm making rules for all 4. 

 

https://community.fabric.microsoft.com/t5/Desktop/Custom-Background-Color-Based-Off-Multiple-Conditi...

View solution in original post

7 REPLIES 7
kp_wood13
Helper I
Helper I

For what it's worth I found a solution in this post. Rather than just looking at the two stages I'm making rules for all 4. 

 

https://community.fabric.microsoft.com/t5/Desktop/Custom-Background-Color-Based-Off-Multiple-Conditi...

kp_wood13
Helper I
Helper I

Ok basically in English I'm looking for:

 

IF 'Query1'[stage]="Initiate" || 'Query1'[stage]="Plan" && 'Query2'[impl_dates]="N" || 'Query2'[funding_dates]="N" || 'Query2'[cost_plan]="N" || 'Query2'[budget_plan]="N" THEN "BLANK" ELSE "GREEN"

As I mentioned it is a scenario to combine measure if you will attach data I will try to show how it can work 🙂

Here's a sample table based on my 'Query1' table. Background colors didn't copy in but basically any "N" in the first two rows should have no background color because [stage]=Initiate or Plan, but the bottom two rows they'd be Red. "Y" is green regardless of the stage listed.

 

stageprj_descriptionimpl_datesimpact_entitiesfunding_datescost_planbudget_plan
InitiateNYNYNY
PlanYNYNYN
ExecuteNYNYNY
CloseYNYNYN

Hi @kp_wood13 
If i understood correctly  you can use Dax measure like :

Flag for formatting =
if ((max('Table'[stage]) = "initiate" || max('Table'[stage]) = "Plan") && max('Table'[Value])= "N", "red",
if (MAX('Table'[Value])= "Y", "green"))
and use it in the conditional formatting of the matrix:
Ritaf1983_0-1703271775129.png

Result:

Ritaf1983_1-1703271800528.png

you can use hex color codes instead of their names if you want other green/red 

Ritaf1983_2-1703272110808.png

PBIX is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickl

Ok so that's mostly working, except that it's changing the colors if Stage=Execute || Close as well. For example, I have a project in Execute stage and it has impl_dates="N" and the measure changed the background to white. That shouldn't happen if the measure is only looking for Initiate or Plan stages and the "N" should be RED if the project is in Execute.

Ritaf1983
Super User
Super User

Hi 
You can create a flag measure with a combined condition with "and" 
And base a conditional formatting on this measure.
For more detailed suggestion 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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.