Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Matrix Timetable - Power BI solution

Hello Comunity, I want to create a kind of time table with a matrix as in the following example in excel. I have 6 milestones. Each number in The Excel corresponds to a milestone.   Example in Ex...
  • MFelix's avatar
    MFelix
    5 years ago

    Hello @Lachsforelle12 ,

    Taking into account the need you have, I have taken the following steps:

    Milestones =
    VAR end_date =
        CALCULATE (
            CONCATENATEX (
                FILTER (
                    'Table';
                    'Table'[EndDate] <= MAX ( 'calendar'[Date] )
                        && 'Table'[EndDate] <> BLANK ()
                );
                'Table'[Milestone];
                UNICHAR ( 10 )
            );
            USERELATIONSHIP ( 'calendar'[Date]; 'Table'[EndDate] )
        )
    VAR start_date =
        CONCATENATEX (
            FILTER ( 'Table'; 'Table'[Date] <= MAX ( 'calendar'[Date] ) );
            'Table'[Milestone];
            UNICHAR ( 10 )
        )
    RETURN
        SWITCH (
            TRUE ();
            start_date = BLANK ()
                && end_date = BLANK (); "0";
            end_date = BLANK (); start_date;
            end_date & UNICHAR ( 10 ) & start_date
        )
    
    Formatting = 
    SWITCH (
        TRUE ();
        EOMONTH ( MAX ( 'calendar'[Date] ); 0 ) = EOMONTH ( TODAY(); 0 )
            && [Milestones] = "0"; 2;
        EOMONTH ( MAX ( 'calendar'[Date] ); 0 ) = EOMONTH ( TODAY(); 0 ); 1;
        [Milestones] = "0"; 0
    )

    You must also create an inactive relationship between the calendar and the end date.

    Now configure your condittional format according to this:

    MFelix_0-1603368697121.png

    MFelix_1-1603368724437.png

    Check Attach File.

    In terms of formatting things can be done in a different way depending on the way you need to do things, but you have the general idea.