Forum Discussion
Matrix
- Anonymous1 year ago
Hi Jyaul1122 ,
This seems to work if you use a matrix for the representation, but if you need an easier way, you can try other visualization like Gantt, just need original tableBest regards,
Albert HeIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Dear Helper,
I have multiple number of project, how you will do
Project = VALUES('Stage Table'[Project])in calendar table,
Hi Jyaul1122 ,
If you have other projects, first you need to create a column that can be recognized separately
Project_Stage = CONCATENATE('Stage Table'[Project],'Stage Table'[Stage_Short])
for start_time and end_time you need to change it like this
Start_time =
VAR CurrentStage = 'Stage Table'[Stage_Short]
VAR CurrentFinish = 'Stage Table'[Finish]
VAR PreviousFinish =
CALCULATE(
MAX('Stage Table'[Finish]),
FILTER(
ALLEXCEPT(
'Stage Table',
'Stage Table'[Project]
),
'Stage Table'[Project] = EARLIER('Stage Table'[Project]) &&
'Stage Table'[Stage_Short] < CurrentStage
)
)
RETURN
IF(
ISBLANK(PreviousFinish),
DATE(YEAR(CurrentFinish), 1, 1),
EOMONTH(PreviousFinish, 0) + 1
)End_time =
VAR _maxdate =
CALCULATE(
MAX('Stage Table'[Finish]),
ALLEXCEPT(
'Stage Table',
'Stage Table'[Stage_Short],
'Stage Table'[Project]
)
)
RETURN
EOMONTH(_maxdate,0)
For the calendar table you need to create two columns
Project_Stage =
SWITCH(
TRUE(),
'Calendar Table'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S1")) &&
'Calendar Table'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S1")),
"Project P1S1",
'Calendar Table'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S2")) &&
'Calendar Table'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S2")),
"Project P1S2",
'Calendar Table'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S3")) &&
'Calendar Table'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S3")),
"Project P1S3",
'Calendar Table'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S4")) &&
'Calendar Table'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S4")),
"Project P1S4",
'Calendar Table'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S5")) &&
'Calendar Table'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S5")),
"Project P1S5",
'Calendar Table'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S6")) &&
'Calendar Table'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S6")),
"Project P1S6",
'Calendar Table'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S7")) &&
'Calendar Table'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P1S7")),
"Project P1S7"
)Stage = RIGHT('Calendar Table'[Project_Stage],2)
The data specified here is from project1, and you need to create another calendar table for project2. Same steps as above
Project_Stage =
SWITCH(
TRUE(),
'Calendar Table2'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S1")) &&
'Calendar Table2'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S1")),
"Project P2S1",
'Calendar Table2'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S2")) &&
'Calendar Table2'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S2")),
"Project P2S2",
'Calendar Table2'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S3")) &&
'Calendar Table2'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S3")),
"Project P2S3",
'Calendar Table2'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S4")) &&
'Calendar Table2'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S4")),
"Project P2S4",
'Calendar Table2'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S5")) &&
'Calendar Table2'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S5")),
"Project P2S5",
'Calendar Table2'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S6")) &&
'Calendar Table2'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S6")),
"Project P2S6",
'Calendar Table2'[Date] >= CALCULATE(MAX('Stage Table'[Start_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S7")) &&
'Calendar Table2'[Date] <= CALCULATE(MAX('Stage Table'[End_time]),FILTER('Stage Table','Stage Table'[Project_Stage] = "Project P2S7")),
"Project P2S7"
)Stage = RIGHT('Calendar Table2'[Project_Stage],2)
Use the union function to join these two tables, provided that the calendar table has the same number of columns and that the absolute positions of these columns correspond to each other.
Table = UNION('Calendar Table','Calendar Table2')
Create a new column
Project = LEFT('Table'[Project_Stage],10)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- Jyaul11221 year agoHelper III
Hi ,
Thanks for your reply but I have 100 of project means i have to create 100 dates table ?
- Anonymous1 year agoNot applicable
Hi Jyaul1122 ,
This seems to work if you use a matrix for the representation, but if you need an easier way, you can try other visualization like Gantt, just need original tableBest regards,
Albert HeIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly