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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
T800
Frequent Visitor

Matrix as Gantt Chart with multiple Starting and End Dates for same row

Dear PBI Community,
let me explain my problem:

I do have 2 Tables: 
1. Is Containing Projects with Start and End Dates (which i can show and have no problems with)

2. Is Containing the project phases assigned to a person again with Start and End Dates

you can see by the following screenshot (ProjectStart and EndDate shown as LookUp here)

T800_1-1637865099594.png

 

The Matrix Gantt Chart looks like this right now (pls ignore pink and light pink cells):

T800_2-1637865304391.png

T800_3-1637865910563.png

 

You see that i am only able to show in darkblue colour the earliest (MIN) and the last (MAX) date entered. BUT  i am missing the phase in August (row 3) since it is in the middle. My question is: How can i show ALL entered phases DateRanges in the same row?

Project + Phase + Responsible are the same but differ from Phase Start and Phase End Dates.


Here my DAX Measure i am using and giving conditional formatting on:


CF Gantt =
// Projects

VAR StartDate =
CALCULATE(
MIN('Total_Report'[StartDate]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR EndDate =
CALCULATE(
MIN('Total_Report'[EndDate]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR ProjectPeriod =
MIN(Dim_M_Calendar[Date])>=StartDate && MIN(Dim_M_Calendar[Date]) <= EndDate
VAR Result =
IF(ProjectPeriod,1,0)

// ProjectPHASES

VAR StartDatePhaseMIN =
CALCULATE(
MIN('Total_Report'[StartDatePhase - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR EndDatePhaseMIN =
CALCULATE(
MIN('Total_Report'[EndDatePhase - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR StartDatePhaseMAX =
CALCULATE(
MAX('Total_Report'[StartDatePhase - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR EndDatePhaseMAX =
CALCULATE(
MAX('Total_Report'[EndDatePhase - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)

VAR PhasePeriodMIN = CALCULATE(
MIN(Dim_M_Calendar[Date])>=StartDatePhaseMIN && MIN(Dim_M_Calendar[Date]) <= EndDatePhaseMIN)
VAR PhasePeriodMAX = CALCULATE(
MAX(Dim_M_Calendar[Date])>=StartDatePhaseMAX && MAX(Dim_M_Calendar[Date]) <= EndDatePhaseMAX)
VAR Result2 =
IF(PhasePeriodMIN || PhasePeriodMAX,1,0)

// Absences

VAR StartDateAbsenceMIN =
CALCULATE(
MIN('Total_Report'[StartDateUrlaub - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR EndDateAbsenceMIN =
CALCULATE(
MIN('Total_Report'[EndDateUrlaub - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR StartDateAbsenceMAX =
CALCULATE(
MAX('Total_Report'[StartDateUrlaub - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR EndDateAbsenceMAX =
CALCULATE(
MAX('Total_Report'[EndDateUrlaub - Month]),
REMOVEFILTERS(Dim_M_Calendar)
)
VAR AbsencePeriodMIN =
MIN(Dim_M_Calendar[Date])>=StartDateAbsenceMIN && MIN(Dim_M_Calendar[Date]) <= EndDateAbsenceMIN
VAR AbsencePeriodMAX =
MAX(Dim_M_Calendar[Date])>=StartDateAbsenceMAX && MAX(Dim_M_Calendar[Date]) <= EndDateAbsenceMAX

VAR Result3 =
IF(AbsencePeriodMIN || AbsencePeriodMAX,3,0)

//Zusammenfassen der Resultate

VAR FinalResult = Result + Result2 + Result3
Return
FinalResult
 

*******************************


You can ignore the absences (pink ones) since it is exactly the same problem like with the phases.

 

Thanks in advance and kind regards

 

 



 

1 REPLY 1
MFelix
Super User
Super User

Hi @T800 ,

 

To what I can see from your data the 3 rows that you present are all from the same projcet/phase so when you make a matrix grouping by project/phase and pick up the maximum (or minimum) from 3 rows you will get only a single value, in this case the 1st of January for the Phase start and the 31 of december for the phase end.

 

In this case you need to make a different comparision in order to get the phase in a different colour.

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.