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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Merge csv files issue

Hello

I tried to fix a problem with merging two csv files. I'm merging them by using a key column and as a result, want to get a column where rows with equal keys return value and rows where keys are not equal return not null, but previous equal value.


Example

2019-08-21 - campaign_name - 2019-08-21campaign_name - live
2019-08-22 - campaign_name - 2019-08-21campaign_name - null
2019-08-23 - campaign_name - 2019-08-21campaign_name - null
2019-08-24 - campaign_name - 2019-08-21campaign_name - change
2019-08-25 - campaign_name - 2019-08-21campaign_name - null
2019-08-26 - campaign_name - 2019-08-21campaign_name - null

So I need to change all null after live to live and all null after change to change.


Advanced Editor formula

let
    Source = Csv.Document(File.Contents("C:\Users\sergey.grytsuk\Desktop\test - data1.csv"),[Delimiter=",", Columns=3, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"date", type date}, {"campaign", type text}, {"key", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"key"}, #"test - data2", {"key"}, "test - data2", JoinKind.LeftOuter),
    #"Expanded test - data2" = Table.ExpandTableColumn(#"Merged Queries", "test - data2", {"cpa_7"}, {"cpa_7"})
in
    #"Expanded test - data2"




 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

If you need to fill null values with first available value, simply use Fill > Down in Query editor.

image.png

Please see the method applied in the example below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUfLJLEtVitWJVnICcsAMZxjDBchwzkjMS4cocIWJu8EY7mBGLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Column1 = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Column1"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value",{"Column1"})
in
    #"Filled Down"
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

If you need to fill null values with first available value, simply use Fill > Down in Query editor.

image.png

Please see the method applied in the example below.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUfLJLEtVitWJVnICcsAMZxjDBchwzkjMS4cocIWJu8EY7mBGLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Column1 = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Column1"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value",{"Column1"})
in
    #"Filled Down"
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

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