Forum Discussion

KDS's avatar
KDS
Helper I
4 years ago
Solved

Save data for use later

I have a report that's gets exported to excel but contains a lot of information I don't need.  One piece of info that's tucked in the section I don't need is the report run date.  I need to save this...
  • AlexisOlson's avatar
    4 years ago

    I'd suggest doing this with independent steps.

     

    Try pasting this into your Advanced Editor and looking at the applied steps one at a time.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY5PC4JAEMW/yrBnwXb7Q3hTO0ZleUjEw2CTBObIth789k0qiBDMwPzmvTdMnqsrtWwdnPBNEEax8tRUhZerG3e2pAC0WXtwQIeAH+BnAHtfa9+sjF76l5RoSNlhPa4SM9NPlZujsNnu/udjdFSx7YWPXKJ7cSNj1D0qcpARWqG0b2kwhwJ36empc0tWEk01iJFsslm8YG+5rlVRfAE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
        DateCellText = Table.SelectRows(Source, each Text.Contains([Column1], "Data as of"))[Column1]{0},
        AsOfDate = Text.AfterDelimiter(DateCellText, "Data as of:"),
        #"Removed Top Rows" = Table.Skip(Source,6),
        #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Category", type text}, {"Location", type text}, {"Budget Year", Int64.Type}, {"Type", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "ReportDate", each Date.FromText(AsOfDate), type date)
    in
        #"Added Custom"