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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Conditional Formatting Color on Rows - Matrix Table - Gantt Chart

Hello -

 

I'm working on creating a Gantt Chart and was able to leverage the one from @KerKol (thanks so much!)

 

I have a list of projects that are further defined into 3 different steps: Fieldwork, Planning, Reporting (Project Category). And I currently have it distinguished by different colors as below.

row1.jpg

 

 

 

 

 

However - I would like to drill everything up (as below), but wanted to see if there was a way to keep the 3 distinguished colors, instead of the solid color line? I've been playing around with the conditional formatting, but haven't had success.

row2.png

 

Link to Kerkol's Power BI file: https://community.fabric.microsoft.com/t5/Data-Stories-Gallery/WoW-2022-Week-08-Gantt-Chart/m-p/2366... (I'm using the "Impossi-Puzzle" / 4 of 4 view)

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

For this you need to create a specific measure that considers the level at wich you are and use it on your condittional formatting:

Colour Formatting =
VAR temptable =
    FILTER (
        Projects,
        Projects[Start Date] <= MIN ( 'Calendar'[Date] )
            && Projects[End Date] >= MAX ( 'Calendar'[Date] )
    )
VAR categoryvalue =
    MAXX ( temptable, Projects[Project Category] )
VAR totalrows =
    COUNTROWS ( temptable )
RETURN
    SWITCH (
        TRUE (),
        totalrows = 1
            && categoryvalue = "FieldWork", "Red",
        totalrows = 1
            && categoryvalue = "Planning", "Blue",
        totalrows = 1
            && categoryvalue = "Reporting", "Yellow",
       "Green"
    )

 

For this metric to work with the individuals colour within each of the values you need to be sure that there is no overlap of dates  for each category, that is why I made the totalrows that checks if there is a single category value for each one, if there is more than one I return the green,

 

MFelix_0-1693822920795.pngMFelix_1-1693822978623.png

 

The measure needs to be updated for you specific usecase.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

2 REPLIES 2
Anonymous
Not applicable

This looks like it will work, much appreciated. Thank you!

MFelix
Super User
Super User

Hi @Anonymous ,

 

For this you need to create a specific measure that considers the level at wich you are and use it on your condittional formatting:

Colour Formatting =
VAR temptable =
    FILTER (
        Projects,
        Projects[Start Date] <= MIN ( 'Calendar'[Date] )
            && Projects[End Date] >= MAX ( 'Calendar'[Date] )
    )
VAR categoryvalue =
    MAXX ( temptable, Projects[Project Category] )
VAR totalrows =
    COUNTROWS ( temptable )
RETURN
    SWITCH (
        TRUE (),
        totalrows = 1
            && categoryvalue = "FieldWork", "Red",
        totalrows = 1
            && categoryvalue = "Planning", "Blue",
        totalrows = 1
            && categoryvalue = "Reporting", "Yellow",
       "Green"
    )

 

For this metric to work with the individuals colour within each of the values you need to be sure that there is no overlap of dates  for each category, that is why I made the totalrows that checks if there is a single category value for each one, if there is more than one I return the green,

 

MFelix_0-1693822920795.pngMFelix_1-1693822978623.png

 

The measure needs to be updated for you specific usecase.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.