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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Traceout
Frequent Visitor

update column value based on value of another column.

Hello, 

I have a snapshot process to track customer traffic that runs every 15 minutes. On a rare occasion the process fails and either has a value of 'null' or a wrong number. I have a column that says whether the process is complete or error. Is there a way to use the prior completed value if there is an error. 

SNAPSHOT IDSNAPSHOT TIMESNAPSHOT STATUSSNAPSHOT CUSTOMERS
117-JAN-24 01.15.00

COMPLETE

500
217-JAN-24 01.30.00ERRORNULL
317-JAN-24 01.45.00ERROR2 "NOT CORRECT VALUE"
417-JAN-24 02.00.00COMPLETE520

 

In the above table is there a way to create a new column or something that would put SNAPSHOT ID values 2 and 3 as 500 to match the most recent completed snapshot?

Like this: 

 

SNAPSHOT IDSNAPSHOT TIMESNAPSHOT STATUSSNAPSHOT CUSTOMERS
117-JAN-24 01.15.00

COMPLETE

500
217-JAN-24 01.30.00ERROR500
317-JAN-24 01.45.00ERROR500
417-JAN-24 02.00.00COMPLETE520

 

The power bi report refreshes 8 times a day so pulls multiple rows at the same time. 

 

Thanks for any assistance you may be able to give. 

 

Example of my linechart with a bad 0 in it creating a bad user experience. 

Traceout_2-1705519593792.png

 

 

 

 

 

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @Traceout ,

 

Here a possible solution in Power Query.

Before:

tackytechtom_1-1705522098461.png

 

 

After:

tackytechtom_0-1705522073790.png

 

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY7BCoAgEER/RfZcoavSOWQvYRqLdbH+/zda6qSdZhjeg6kVDAxg5nFd0ohOaTMZP2ktY8jbHqmQVC/DPVTAnrX6Y4k5s2Q6YnxJ25POtySqC1IuKmRmCkWdSzzogld2rYxi/i+hXLof", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"SNAPSHOT ID" = _t, #"SNAPSHOT TIME" = _t, #"SNAPSHOT STATUS" = _t, #"SNAPSHOT CUSTOMERS" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"SNAPSHOT ID", Int64.Type}, {"SNAPSHOT TIME", type text}, {"SNAPSHOT STATUS", type text}, {"SNAPSHOT CUSTOMERS", type text}}),
    #"Replace Values" = Table.ReplaceValue(#"Changed Type",each [SNAPSHOT CUSTOMERS],each if [SNAPSHOT STATUS] = "ERROR" then null else [SNAPSHOT CUSTOMERS],Replacer.ReplaceValue,{"SNAPSHOT CUSTOMERS"}),
    #"Filled Down" = Table.FillDown(#"Replace Values",{"SNAPSHOT CUSTOMERS"})

in
    #"Filled Down"

 

Let me know if this solves your query 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

1 REPLY 1
tackytechtom
Super User
Super User

Hi @Traceout ,

 

Here a possible solution in Power Query.

Before:

tackytechtom_1-1705522098461.png

 

 

After:

tackytechtom_0-1705522073790.png

 

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZY7BCoAgEER/RfZcoavSOWQvYRqLdbH+/zda6qSdZhjeg6kVDAxg5nFd0ohOaTMZP2ktY8jbHqmQVC/DPVTAnrX6Y4k5s2Q6YnxJ25POtySqC1IuKmRmCkWdSzzogld2rYxi/i+hXLof", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"SNAPSHOT ID" = _t, #"SNAPSHOT TIME" = _t, #"SNAPSHOT STATUS" = _t, #"SNAPSHOT CUSTOMERS" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"SNAPSHOT ID", Int64.Type}, {"SNAPSHOT TIME", type text}, {"SNAPSHOT STATUS", type text}, {"SNAPSHOT CUSTOMERS", type text}}),
    #"Replace Values" = Table.ReplaceValue(#"Changed Type",each [SNAPSHOT CUSTOMERS],each if [SNAPSHOT STATUS] = "ERROR" then null else [SNAPSHOT CUSTOMERS],Replacer.ReplaceValue,{"SNAPSHOT CUSTOMERS"}),
    #"Filled Down" = Table.FillDown(#"Replace Values",{"SNAPSHOT CUSTOMERS"})

in
    #"Filled Down"

 

Let me know if this solves your query 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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