none
Grouping in Power query RRS feed

  • Question

  • Hello, there is a simple table with time, name and sessions occured. I'd like to group the table by session, count the occurence within session and keep the first time of the session/ Please look below:

    time name Session_num
    11:13:54 A session 1
    11:15:05 A session 1
    11:16:30 A session 1
    14:13:54 A session 2
    15:13:54 A session 3
    10:24:33 B session 1
    10:33:00 B session 1
    11:16:30 B session 2
    14:13:54 B session 3
    15:13:54 C session 1
     

    Result:

    time name Session_num count
    11:13:54 A session 1 3
    14:13:54 A session 2 1
    15:13:54 A session 3 1
    10:24:33 B session 1 2
    11:16:30 B session 2 1
    14:13:54 B session 3 1
    15:13:54 C session 1 1

     
    Thursday, September 19, 2019 1:25 PM

Answers

  • Hi Adam,

    Assuming, your column names are Date and Session:

    = Table.Group(YourTable, "Session", {{"min", each List.Min([Date])}, {"cnt", Table.RowCount}})
    • Marked as answer by Adam543 Thursday, September 19, 2019 1:53 PM
    Thursday, September 19, 2019 1:48 PM

All replies

  • Hi Adam,

    Assuming, your column names are Date and Session:

    = Table.Group(YourTable, "Session", {{"min", each List.Min([Date])}, {"cnt", Table.RowCount}})
    • Marked as answer by Adam543 Thursday, September 19, 2019 1:53 PM
    Thursday, September 19, 2019 1:48 PM
  • Perfect, thank you!
    Thursday, September 19, 2019 1:53 PM