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 code:
fillGuids <- clean %>%
arrange(User, Serial, desc(ClientTime_clean), MetaGuid, desc(Action)) %>%
mutate(MetaGuid_filled = zoo::na.locf(MetaGuid, na.rm=FALSE)) %>%
ungroup() %>% #fill all missing MetaGuids that come after first log by User/Serial/date
This is the desired output for the MetaGuid_filled field, derived from the MetaGuid field. However, the output from PowerBI is just what's in MetaGuid. No errors are thrown, but this is not the expected behavior of na.locf. Not to mention the exact same code works when using my RStudio IDE.
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.