Forum Discussion

Afe0451's avatar
Afe0451
New Member
3 years ago
Solved

Creating Gantt chart from matrix contains blank top rows

Hi, I'm very new to Power BI and currently having problem with creating a Gantt chart from matrix. 

I found a guide on youtube on how to make it: https://www.youtube.com/watch?v=8pbFvBMT9L8

However when I tried to recreate it using my data somehow the top row of the matrix is empty and seems like it is causing problem to the values. I have no idea what causes this problem as I believe I already tried to make my data as similar to the sample as possible.

 

 

Here is the pbix file: https://1drv.ms/u/s!Al8OhkPPDetrcczUeD3QJIEqorE

 

Any help is appreciated, thank you very much!

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Afe0451 ,

     

    Here I suggest you to remove the relationship between 'Calendar' and "Project(2)" tables.

    Then try this measure.

    ColumnValues = 
    VAR _startDate =
        CALCULATE ( MAX ( 'Project (2)'[Start Date] ) )
    VAR _endDate =
        CALCULATE ( MAX ( 'Project (2)'[Finish Date] ) )
    VAR _status =
        CALCULATE ( MAX ( 'Project (2)'[Status] ) )
    VAR _period =
        MAX ( 'Calendar'[Date] ) >= _startDate
            && MAX ( 'Calendar'[Date] ) <= _endDate
    RETURN
        IF (
             _period,
            SWITCH ( _status, "Completed", 1, "Completed-Late", 2, "In Progress", 3 )
        )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Afe0451 ,

     

    Here I suggest you to remove the relationship between 'Calendar' and "Project(2)" tables.

    Then try this measure.

    ColumnValues = 
    VAR _startDate =
        CALCULATE ( MAX ( 'Project (2)'[Start Date] ) )
    VAR _endDate =
        CALCULATE ( MAX ( 'Project (2)'[Finish Date] ) )
    VAR _status =
        CALCULATE ( MAX ( 'Project (2)'[Status] ) )
    VAR _period =
        MAX ( 'Calendar'[Date] ) >= _startDate
            && MAX ( 'Calendar'[Date] ) <= _endDate
    RETURN
        IF (
             _period,
            SWITCH ( _status, "Completed", 1, "Completed-Late", 2, "In Progress", 3 )
        )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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