Forum Discussion

eHorizons's avatar
eHorizons
Frequent Visitor
2 years ago
Solved

Create timepoint for observation based on dates

Hi Everyone! I have a table like the one below with IDs that correspond to a specific person and dates of observation. I am wondering how to create the Timepoint column in bold below. I want to labe...
  • AlienSx's avatar
    2 years ago

    hi, eHorizons 

    let
        Source = table_like_the_one_below,
        gr = Table.Group(
            Source, "ID", 
            {{"points", each Table.AddIndexColumn(Table.Sort(_, "Date"), "Timepoint", 1, 1)}}
        ),
        expand = Table.ExpandTableColumn(gr, "points", {"Date", "Timepoint"})
    in
        expand