Forum Discussion

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Zneta ,

     

    Here are the steps you can follow:

    1. Create calculated column.

    Date =
    DATE(YEAR('Table'[Fault start]),MONTH('Table'[Fault start]),DAY('Table'[Fault start]))
    Minute =
    var _mindate=
    MINX(FILTER(ALL('Table'),'Table'[Date]=EARLIER('Table'[Date])),[Fault start])
    var _maxdate=
    MAXX(FILTER(ALL('Table'),'Table'[Date]=EARLIER('Table'[Date])),[Fault end])
    return
    DATEDIFF(
        _mindate,_maxdate,MINUTE)

    2. Create measure.

    Measure =
    var _mindate=MAX('Table'[Date]) + TIME(0,0,0)
    var _maxdate=_mindate +1
    var _oneday=
    DATEDIFF(
        _mindate,_maxdate,MINUTE)
    return
    _oneday - MAX('Table'[Minute])

    3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • Zneta's avatar
    Zneta
    Frequent Visitor

    Thank you, this is a great starting point. I followed your steps but for some reason the Fault Durations are not being added up. For example the first two Faults are within the same time frame. So the first faultduration should read 1696 as it is 1696 seconds long. The second FaultDuration should also read 1696 since that fault is in the time frame of the first and wont add to the total. why does it only show 5? unlike in your example.

     

  • Zneta's avatar
    Zneta
    Frequent Visitor

    Can anyone help me out with this problem? Like i said. The first idea is not bad but it doesnt quite work or I made a mistake