Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
KDS
Helper I
Helper I

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 for use later down in the process, after I clean up the data.

 

Here's a example of what I mean...

Capture.PNG

 

The data in black is info I don't need.  The data in blue is the info I do need.  The info in red is explained below.

 

I need to retain the report date so i can extract the report monthThat field will then be used as part of a join so I can pull data corresponding to that month in another table. 

 

The first thing I did was create a custom column with a formula that extracted the report date from the first column:

if Text.Contains([Data.Column1],"Data As Of:") then Text.Start(Text.AfterDelimiter([Data.Column1], "Data As Of: "),10) else null

 

Next, I did a fill down to populate the rest of the columns and then created a custom column named "Report Month"  to extract the month number only.  

 

The issue I'm having is that the data i need doesn't start until row 7.  To get to this, I excluded anything in Column 2 that is null.  In doing so, however, I lost the column header for the Report Month.  So when I promote headers, my header is now "8"... which obviously isn't going to work for my join as the report month will change with each update.

 

How do I get around this?

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

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"

 

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

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"

 

Thanks - with some tweaking I was able to get this to work!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors