Forum Discussion
rlu
6 years agoFrequent Visitor
zoo's na.locf function not filling fields with R script in Power Query Editor
I'm trying to use the zoo package's na.locf() function to fill missing values in adjacent rows. It works when I run it in RStudio, but it does not work in PowerBI. Here's an abridged version of the R...
dax
6 years agoCommunity Support
Hi rlu,
I am not familiar on R script, I will discuss this with outhers and try to reproduce this in my environment. I will inform you as soon as I get it
In addition, if you want to fill it up, why not use M code to achieve this goal
You could replace empty cell by null, then click Fill->down
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0MjYxNVPSUXIEYkMgDstMLXfJTy7NTc0rAQkZ6BsZ6RsZGFoqxeoMPvVICl0rUpNLS1KDUxOLkjMwVTpZWpibmZoQbTKp6ol0SSwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [MetaGuid = _t, User = _t, Serial = _t, Action = _t, ClientTime_clean = _t]),
#"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"MetaGuid"}),
#"Filled Down" = Table.FillDown(#"Replaced Value",{"MetaGuid"})
in
#"Filled Down"
Thanks for your understanding and support.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rlu
6 years agoFrequent Visitor
Thanks for your response Zoe. I'm looking to maintain just one data munging pipeline as I use the same R script for offline analysis as well and wanted to use the same script to turn on a PowerBI dashboard to monitor metrics. Thus, M code will not be beneficial for me.