Forum Discussion

aTChris's avatar
aTChris
Resolver I
5 years ago
Solved

Problems with GroupKind.Local

I'm working with a dataset that has events recorded which I need to group when an attribute changes. I used https://blog.crossjoin.co.uk/2014/01/03/aggregating-by-local-groups-in-power-query/ The i...
  • v-lionel-msft's avatar
    5 years ago

    Hello @aTChris ,

    You can use DAX to accomplish this.

    1. Add an [Index] column.

    2. Create a calculated column.

    __start = 
    VAR x = 
    CALCULATE(
        MAX(Sheet6[end]),
        FILTER(
            Sheet6,
            Sheet6[Index] = EARLIER(Sheet6[Index]) - 1
        )
    )
    RETURN
    IF(
        x = BLANK(),
        [start],
        x + 1/86400
        
    )

    v-lionel-msft_0-1601889270523.png

    Best regards
    Lionel Chen

    If this post helps,then consider Accepting it as the solution to help other members find it faster.