Forum Discussion

cottrera's avatar
cottrera
Post Prodigy
2 years ago
Solved

M code to capture status changes and #days before status changes again

Hi Community, bit of a tricky request but here goes.  I have added a link to my data set. https://github.com/Cottera/Sample-Data/blob/main/Status%20changes%20over%20time.csv   This example is for ...
  • lbendlin's avatar
    lbendlin
    2 years ago

     

    let
        Source = Csv.Document(File.Contents("C:\Users\xxx\Downloads\Status changes over time multiple job numbers.csv"),[Delimiter=",", Columns=10, Encoding=65001, QuoteStyle=QuoteStyle.None]),
        #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"DateADDED", type date}},"en-GB"),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Job Number", "Job Status Description"}, {{"Min DateAdded", each List.Min([DateADDED]), type nullable text}, {"Max DateAdded", each List.Max([DateADDED]), type nullable text}},GroupKind.Local)
    in
        #"Grouped Rows"