Forum Discussion

danny_b's avatar
danny_b
Regular Visitor
1 year ago
Solved

Gantt Matrix - How do I show multiple project phases in a single row and color format each phase?

Hello,   I have built a gantt chart using a matrix visual, however, each project has multiple phases on different dates.  My data is below and I also have a date table I'm referencing: New Project...
  • Anonymous's avatar
    Anonymous
    1 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