Forum Discussion
Formatting to create a Gantt Chart
Hi, I am attempting to create a Gantt chart in powerbi. I have a production table that is filtered by a date table and a Project table (needed to have the project expenses filtered correctly for a different visual). The dax below works if I remove the selected value part of the measure, with the exception that it includes all production units even if there is no data in them. The issue appears to be the column that doesn't have a date, Any ideas on how i would filter those out?
my dax is:
I decided to add estimate and actual timelines. the code i used was:
Gantt =VAR EST_StartDate =CALCULATE(Min(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[DA_Est_Qty_Complete] >0)VAR EST_EndDate =CALCULATE(MAX(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[DA_Est_Qty_Complete] >0)VAR EST_ProjectPeriod =MIN('Date'[WeekEnding]) >= EST_StartDate&& Max('Date'[WeekEnding]) <= EST_EndDateVAR Actual_StartDate =CALCULATE(Min(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[Qty_Complete] >0)VAR Actual_EndDate =CALCULATE(MAX(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[Qty_Complete] >0)VAR Actual_ProjectPeriod =MIN('Date'[WeekEnding]) >= Actual_StartDate&& Max('Date'[WeekEnding]) <= Actual_EndDateVAR EST_Actual_ProjectPeriod =MIN('Date'[WeekEnding]) >= Actual_StartDate && MIN('Date'[WeekEnding]) >= Est_StartDate&& Max('Date'[WeekEnding]) <= Actual_EndDate && Max('Date'[WeekEnding]) <= Est_EndDateVAR RESULT =SWITCH(TRUE(),EST_Actual_ProjectPeriod,3,Actual_ProjectPeriod,2,EST_ProjectPeriod,1)RETURNRESULT
2 Replies
- amitchandak
Super User
SCNCKS1 , Refer if this can help
Matrix as Project plan Visual: https://youtu.be/R25QoiyoSVs
Power BI Matrix as Calendar Display & Conditional formatting: https://youtu.be/O93dTEt24ZE
- SCNCKS1
Helper I
I decided to add estimate and actual timelines. the code i used was:
Gantt =VAR EST_StartDate =CALCULATE(Min(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[DA_Est_Qty_Complete] >0)VAR EST_EndDate =CALCULATE(MAX(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[DA_Est_Qty_Complete] >0)VAR EST_ProjectPeriod =MIN('Date'[WeekEnding]) >= EST_StartDate&& Max('Date'[WeekEnding]) <= EST_EndDateVAR Actual_StartDate =CALCULATE(Min(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[Qty_Complete] >0)VAR Actual_EndDate =CALCULATE(MAX(PROD_COST_TABLE[Dates]),REMOVEFILTERS('Date'),PROD_COST_TABLE[Qty_Complete] >0)VAR Actual_ProjectPeriod =MIN('Date'[WeekEnding]) >= Actual_StartDate&& Max('Date'[WeekEnding]) <= Actual_EndDateVAR EST_Actual_ProjectPeriod =MIN('Date'[WeekEnding]) >= Actual_StartDate && MIN('Date'[WeekEnding]) >= Est_StartDate&& Max('Date'[WeekEnding]) <= Actual_EndDate && Max('Date'[WeekEnding]) <= Est_EndDateVAR RESULT =SWITCH(TRUE(),EST_Actual_ProjectPeriod,3,Actual_ProjectPeriod,2,EST_ProjectPeriod,1)RETURNRESULT