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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dading
Helper II
Helper II

refer value of previous row with criteria

Hi

Can someone help me to modify table below using M query?

 

i have a table like this

date

Eqmt

Loc
5/23/2020 07:30E1A
5/23/2020 09:00E1B
5/23/2020 09:30E1null
5/23/2020 11:00E1null
5/23/2020 07:30E2C
5/23/2020 09:00E2null
5/23/2020 09:30E2D
5/23/2020 11:00E2null

 

and I want to get the latest of  loc as long as it occurs in the same eqmt, as shown below

can we do this?

date

Eqmt

Loc
5/23/2020 07:30E1A
5/23/2020 09:00E1B
5/23/2020 09:30E1B
5/23/2020 11:00E1B
5/23/2020 07:30E2C
5/23/2020 09:00E2C
5/23/2020 09:30E2D
5/23/2020 11:00E2D

 

thank you

1 ACCEPTED SOLUTION
nandukrishnavs
Super User
Super User

@dading 

Use Fill option in the Edit Query.

Power-Query-Fill-Down-Blank-or-Null-Cells-with-Values.gif

 

PowerQuery for your reference.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU3MtY3MjAyUDAwtzI2UNJRcjUEEo5KsTookpZWBnBJJ0xJhE40OUNDJI3o+mA2GgEJZ1w2GmHRaImk0QWXjRCNsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, Eqmt = _t, Loc = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type text}, {"Eqmt", type text}, {"Loc", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","",null,Replacer.ReplaceValue,{"Loc"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value",{"Loc"})
in
    #"Filled Down"

 

Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

1 REPLY 1
nandukrishnavs
Super User
Super User

@dading 

Use Fill option in the Edit Query.

Power-Query-Fill-Down-Blank-or-Null-Cells-with-Values.gif

 

PowerQuery for your reference.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtU3MtY3MjAyUDAwtzI2UNJRcjUEEo5KsTookpZWBnBJJ0xJhE40OUNDJI3o+mA2GgEJZ1w2GmHRaImk0QWXjRCNsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, Eqmt = _t, Loc = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type text}, {"Eqmt", type text}, {"Loc", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","",null,Replacer.ReplaceValue,{"Loc"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value",{"Loc"})
in
    #"Filled Down"

 

Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors