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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Vladmill
New Member

IF cell is empty, FILL cell with top value, ELSE skip

Hello Everyone,

 

The questions is how to fill the cell with top value if it is empty, if it is not empty -> skip.

 

Снимок.PNG

 

The difficulty is that there is not connection or path between country <-> city.

 

 

Any help would be appreciated 😃

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

You can fill down and use replace value with some dummy input.
Next adjust the generated code as in the query below.

An additonal step is required to restore the column types, as this use of Table.ReplaceValue changes all column types to "any".

 

let
    Source = Table1,
    #"Filled Down" = Table.FillDown(Source,{"Country"}),
    #"Replaced Value" = Table.ReplaceValue(#"Filled Down",each [Country],each if [City] = null then null else [Country],Replacer.ReplaceValue,{"Country"}),
    #"Restored ColumnTypes" = Value.ReplaceType(#"Replaced Value",Value.Type(#"Filled Down"))
in
    #"Restored ColumnTypes"
Specializing in Power Query Formula Language (M)

View solution in original post

1 REPLY 1
MarcelBeug
Community Champion
Community Champion

You can fill down and use replace value with some dummy input.
Next adjust the generated code as in the query below.

An additonal step is required to restore the column types, as this use of Table.ReplaceValue changes all column types to "any".

 

let
    Source = Table1,
    #"Filled Down" = Table.FillDown(Source,{"Country"}),
    #"Replaced Value" = Table.ReplaceValue(#"Filled Down",each [Country],each if [City] = null then null else [Country],Replacer.ReplaceValue,{"Country"}),
    #"Restored ColumnTypes" = Value.ReplaceType(#"Replaced Value",Value.Type(#"Filled Down"))
in
    #"Restored ColumnTypes"
Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.