Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Average Spacing

[ Spoiler ] Hello,    I am having problems calculating the average spacing between dates 
  • v-gizhi-msft's avatar
    v-gizhi-msft
    6 years ago

    Hi,

     

    Please take following steps:

    1)Add an index column to the original table in Query Editor.

    2)Try this column to combine date and time columns:

    Date-Time = 'Table'[Date]+'Table'[Time]

    3)Try this calcluated column:

    Column =
    DATEDIFF (
        CALCULATE (
            MAX ( 'Table'[Date-Time] ),
            FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) - 1 )
        ),
        'Table'[Date-Time],
        SECOND
    )

    4)The result shows:

    See my attached pbix file.

     

    Best Regards,

    Giotto