Forum Discussion
Gantt Matrix - How do I show multiple project phases in a single row and color format each phase?
- Anonymous1 year ago
Thanks for the reply from bhanu_gautam , please allow me to provide another insight:
Hi, danny_b
Thanks for reaching out to the Microsoft fabric community forum.My idea is similar to bhanu_gautam's.Regarding the issue you raised, my solution is as follows:
1.First, I created the following calculated table to serve as the columns of the matrix:
Fiscal Calendar = CALENDAR ( MINX ( { MIN ( 'New Project Table'[First Date] ), MIN ( 'New Project Table'[Last Date] ) }, [Value] ), MAXX ( { MAX ( 'New Project Table'[First Date] ), MAX ( 'New Project Table'[Last Date] ) }, [Value] ) )2.Next, I used the following measures as the values of the matrix:
Measure = VAR market1m = CALCULATE ( MIN ( 'New Project Table'[First Date] ), FILTER ( ALLEXCEPT ( 'New Project Table', 'New Project Table'[Project] ), 'New Project Table'[Phase] = "Market" ) ) VAR market2m = CALCULATE ( MAX ( 'New Project Table'[Last Date] ), FILTER ( ALLEXCEPT ( 'New Project Table', 'New Project Table'[Project] ), 'New Project Table'[Phase] = "Market" ) ) VAR Pilot1m = CALCULATE ( MIN ( 'New Project Table'[First Date] ), FILTER ( ALLEXCEPT ( 'New Project Table', 'New Project Table'[Project] ), 'New Project Table'[Phase] = "Pilot" ) ) VAR Pilot2m = CALCULATE ( MAX ( 'New Project Table'[Last Date] ), FILTER ( ALLEXCEPT ( 'New Project Table', 'New Project Table'[Project] ), 'New Project Table'[Phase] = "Pilot" ) ) VAR National1m = CALCULATE ( MIN ( 'New Project Table'[First Date] ), FILTER ( ALLEXCEPT ( 'New Project Table', 'New Project Table'[Project] ), 'New Project Table'[Phase] = "National" ) ) VAR National2m = CALCULATE ( MAX ( 'New Project Table'[Last Date] ), FILTER ( ALLEXCEPT ( 'New Project Table', 'New Project Table'[Project] ), 'New Project Table'[Phase] = "National" ) ) RETURN SWITCH ( TRUE (), MAX ( 'Fiscal Calendar'[Date] ) >= market1m && MAX ( 'Fiscal Calendar'[Date] ) <= market2m, "#FF0000", MAX ( 'Fiscal Calendar'[Date] ) >= Pilot1m && MAX ( 'Fiscal Calendar'[Date] ) <= Pilot2m, "#00FF00", MAX ( 'Fiscal Calendar'[Date] ) >= National1m && MAX ( 'Fiscal Calendar'[Date] ) <= National2m, "#0000FF", "#FFFFFF" )3.Then, I modified the background colour:
4.Here's my final result, which I hope meets your requirements.
5.You may need to note that the matrix's column display has a 100-row limit. For more details, please refer to the documentation:
Solved: Missing Columns in Matrix - Microsoft Fabric Community
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
danny_b You need to create a measure that checks if a date falls within the start and end dates of each phase.
DAX
CF Gantt Phase =
VAR CurrentDate = MIN('Fiscal Calendar'[Calendar Date])
VAR Phase1Start = CALCULATE(MIN('New Project Table'[First Date]), 'New Project Table'[Phase] = "Pilot")
VAR Phase1End = CALCULATE(MAX('New Project Table'[Last Date]), 'New Project Table'[Phase] = "Pilot")
VAR Phase2Start = CALCULATE(MIN('New Project Table'[First Date]), 'New Project Table'[Phase] = "Market")
VAR Phase2End = CALCULATE(MAX('New Project Table'[Last Date]), 'New Project Table'[Phase] = "Market")
VAR Phase3Start = CALCULATE(MIN('New Project Table'[First Date]), 'New Project Table'[Phase] = "National")
VAR Phase3End = CALCULATE(MAX('New Project Table'[Last Date]), 'New Project Table'[Phase] = "National")
RETURN
SWITCH(
TRUE(),
CurrentDate >= Phase1Start && CurrentDate <= Phase1End, 1,
CurrentDate >= Phase2Start && CurrentDate <= Phase2End, 2,
CurrentDate >= Phase3Start && CurrentDate <= Phase3End, 3,
BLANK()
)
Use the measure CF Gantt Phase to apply conditional formatting in the matrix visual. You can set different colors for the values 1, 2, and 3, which correspond to different phases.