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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Conditional Formatting by comparing Two State Columns

Hi Team,

 

I have four colums Source Id and its State and Target ID and its State. I would like to achieve rollup of  targetID state and then color code the source Id (Title) to either Red or Green, Soure Id can have single/multiple Target ID's associated (Parent an child tasks)

 

Source State (Phase 1 - Identity, Phase 2 - Investigate, Phase 3 - Prototype)

Target State ( New,ready,Done,Test,Removed,Blocked,Dev,Test)

 

Here are the cross check for each stage

 

Phase 1 - Identity
Blocked
New
Removed

 

Phase 2 - Investigate
Blocked
Ready
Removed


Phase 3 - Prototype
Done
Dev
Test
Blocked
Removed

 

Not sure how to do a rollup of status and color code. so ,any thoughts or DAX examples will help me a lot !

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Try to create a measure and set conditional formatting like so:

Icey_1-1647916988198.png

Measure = 
VAR SourceStates_ =
    VALUES ( 'Stage State'[Source State] )
VAR CurSourceState_ =
    MAX ( Source[Source State] )
VAR TargetStates_ =
    CALCULATETABLE (
        VALUES ( 'Stage State'[Target State] ),
        'Stage State'[Source State] = CurSourceState_
    )
VAR CurTargetStates_ =
    CALCULATETABLE (
        VALUES ( Source[Target State] ),
        ALLEXCEPT ( Source, Source[Source ID], Source[Source State] )
    )
VAR ExceptTargetStatesCount_ =
    COUNTROWS ( EXCEPT ( CurTargetStates_, TargetStates_ ) )
RETURN
    IF ( CurSourceState_ IN SourceStates_ && ExceptTargetStatesCount_ = 0, "Green", "Red" )

Icey_0-1647916436735.png

Icey_3-1647917118672.png

 

And Matrix visual can't set conditional formatting on fields on Rows or Columns.

Icey_2-1647917074849.png

 

 

Best Regards,

Icey

 

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

5 REPLIES 5
Icey
Community Support
Community Support

Hi @Anonymous ,

 

I don't quite understand your requirements. Could you share me more details? For example,

 

1. You said "Conditional Formatting by comparing Two State Columns" in title, and then how do you compare them? What's the rule?

 

2. Is the sample table you provided the expected result you want? How do you identify which is red or which is green?

 

 

 

Best Regards,

Icey

Anonymous
Not applicable

Hi Icey,

 

when a Source ID state is marked as Phase 1 - Identity then child tasks (Target ID) states can be in Blocked or  New or Removed. If any of the child tasks are not in these three states then i want to mark Source ID as red. To set the Source ID to either Red/Green here are the cross checks

 

Phase 1 - Identity
Blocked
New
Removed

 

Phase 2 - Investigate
Blocked
Ready
Removed


Phase 3 - Prototype
Done
Dev
Test
Blocked
Removed

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Try to create a measure and set conditional formatting like so:

Icey_1-1647916988198.png

Measure = 
VAR SourceStates_ =
    VALUES ( 'Stage State'[Source State] )
VAR CurSourceState_ =
    MAX ( Source[Source State] )
VAR TargetStates_ =
    CALCULATETABLE (
        VALUES ( 'Stage State'[Target State] ),
        'Stage State'[Source State] = CurSourceState_
    )
VAR CurTargetStates_ =
    CALCULATETABLE (
        VALUES ( Source[Target State] ),
        ALLEXCEPT ( Source, Source[Source ID], Source[Source State] )
    )
VAR ExceptTargetStatesCount_ =
    COUNTROWS ( EXCEPT ( CurTargetStates_, TargetStates_ ) )
RETURN
    IF ( CurSourceState_ IN SourceStates_ && ExceptTargetStatesCount_ = 0, "Green", "Red" )

Icey_0-1647916436735.png

Icey_3-1647917118672.png

 

And Matrix visual can't set conditional formatting on fields on Rows or Columns.

Icey_2-1647917074849.png

 

 

Best Regards,

Icey

 

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

Anonymous
Not applicable

Thank you so much. This will be a game changer for me 😀

Anonymous
Not applicable

Example: 

 

Source IDSource StateTarget IDTarget State
219203(Red)New249831Blocked
  247611Ready
295531(Green)Phase 3 - Prototype569794Done
295531 328384Removed
295531 328382Done
295531 812856Done
295531 519393Dev
308468(Red)Phase 3 - Prototype890933Ready
  872697New
335460(Red)Phase 3 - Prototype291654Done
  336072Removed
  350896Removed
  863825New
  868718New
  860056New

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors