Forum Discussion

mHarbo's avatar
mHarbo
New Member
5 years ago

I have problem regarding the datediff

I have problem regarding the time difference between two dates. 

 

The dax code is:

DATEDIFF([AssignedDate],CALCULATE(Min([Modified]), [RevisionNumber]>[RevisionNumber]+1),HOUR)

 

The reason for this is that i want to calculate the time between when a "rask" is assigned and when its modified. When a task is modifed it gets a revision number and that number increases each time it's modified.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I guess this is a formula in a calculated column? If so, then you'd be much better off moving the calculation to Power Query. Invoking measures on big fact tables row-by-row is one of the worst things you can do in Power BI.

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    mHarbo 

    =VAR _rn=[RevisionNumber] RETURN DATEDIFF([AssignedDate],MINX(FILTER(Table,[RevisionNumber]>_rn+1),[Modified]),HOUR)

  • mHarbo , Try a new column like

    DATEDIFF([AssignedDate],MinX(filter(Table,[RevisionNumber]>earlier([RevisionNumber])+1),[Modified]),HOUR)