Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Measure for time difference between non-consecutive rows?

Hi,   I'm fairly new to Power BI so forgive me if this is a common question, I couldn't find anything specific to non-consecutive, variable distance rows. I'm trying to calculate the total delivery...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    Please refer to my pbix to see if it helps you.

    Create a measure.

     

    Measure =
    VAR _min_arrive =
        CALCULATE (
            MIN ( 'Table'[Arrive] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[Truck Name] = SELECTEDVALUE ( 'Table'[Truck Name] )
            )
        )
    VAR _max_time =
        CALCULATE (
            MAX ( 'Table'[Depart] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[Truck Name] = SELECTEDVALUE ( 'Table'[Truck Name] )
            )
        )
    RETURN
        _max_time - _min_arrive
    

     

    If I have misunderstood your meaning, please provide your desired output and pbix without privacy information.

     

     

     

    Best Regards

    Community Support Team _ Polly