Forum Discussion
Single date in matrix gantt
- 1 year ago
So ive put that code, and changed it to the below ive even tried the code on its own. It doesnt return a value of 2. Ive set teh relationship to one to many.
Highlight date =VAR StartDate =CALCULATE(MIN('20240529-DCC Task Planner'[Task start date]),REMOVEFILTERS(dimDate))VAR EndDate =CALCULATE(MIN('20240529-DCC Task Planner'[Task Finish date]),REMOVEFILTERS(dimDate))VAR ProjectPeriod =MIN(dimDate[Date]) >= StartDate&& MIN(dimDate[Date]) <= EndDateVAR result1 =IF(ProjectPeriod,1)VAR AirbidDate =CALCULATE(MIN('20240529-DCC Task Planner'[Air Bid submission date(Deploy)]),REMOVEFILTERS(dimDate))VAR AirBid =MIN(dimDate[Date]) = AirbidDateVAR result2 =IF(AirBid,2)VAR FinalResult = result2 + result1ReturnFinalResult
Hi Aliwells632,
Thanks for using Microsoft Fabric Community Forum.
Your current measure determines whether a task's date range falls within the given start and end dates, returning 1 if true. You now want to incorporate a specific date (Sea Bid Date) so that when it matches a date in the matrix, the measure returns 2, allowing you to conditionally format it differently.
You need to check if the current date in the matrix (dimDate[Date]) matches the Sea Bid Date. If it does, return 2
Try this Updated Measure:
CF Gantt1 =
VAR StartDate =
CALCULATE(
MIN('20240529-DCC Task Planner'[Task start date]),
REMOVEFILTERS(dimDate)
)
VAR EndDate =
CALCULATE(
MIN('20240529-DCC Task Planner'[Task Finish date]),
REMOVEFILTERS(dimDate)
)
VAR SeaBidDate =
CALCULATE(
MIN('20240529-DCC Task Planner'[Sea Bid Date]),
REMOVEFILTERS(dimDate)
)
VAR ProjectPeriod =
MIN(dimDate[Date]) >= StartDate &&
MIN(dimDate[Date]) <= EndDate
VAR IsSeaBidDate =
MIN(dimDate[Date]) = SeaBidDate
VAR Result =
IF(IsSeaBidDate, 2, IF(ProjectPeriod, 1))
RETURN
Result
If this solution worked for you, kindly mark it as Accept as Solution and feel free to give a Kudos, it would be much appreciated!
Thank you.