Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

DATEDIFF between two tasks in same column

Hello,   I am fairly new to Power BI and DAX. I am trying to get a DATEDIFF between two tasks within the same column. There are other tasks in the workflow besides what I want to calculate. I was a...
  • FreemanZ's avatar
    3 years ago

    hi Anonymous 

    try to write the column like this:

    ReworkInMinutes = 
    VAR _date = [Task Start Date] 
    VAR _id = [Workflow_ID]
    VAR _reworkdate = 
    MAXX(
        FILTER(
            TableName,
            TableName[Task Start Date] <_date
                &&TableName[Workflow_ID] = _id
                &&TableName[Task] = "Rework"
        ),
        TableName[Task Start Date]
    )
    RETURN
    IF(
        [Task]="Submit for Approval",
        DATEDIFF(_reworkdate, _date, MINUTE),
        BLANK()
    )

     

    it worked like this: