Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Can anyone please help me in understanding the R Query in my powerBI report , so based on that I will change it in perl Script.
new_data <- dataset[dataset$ParName == 'Turbidity Field (NTU)',c('DepthValue','ResultValue','SampleDate', 'StationID')]
new_data$ResultValue = round(new_data$ResultValue, 2)
xrange <- range(new_data$ResultValue)
yrange <- range(new_data$DepthValue)
yrange <- range(c(0, yrange[2]))
plot(xlim=xrange, yrange, ylim = rev(yrange), type="n", xlab="Turbidity Field (NTU)",ylab="Depth", axes=FALSE )
all_lines <- unique(paste(new_data$SampleDate, new_data$StationID))
colors <- c()
c <- 0
for (i in all_lines) {
c <- c + 1
colors <- c(colors, c)
}
cc <- 0
limited_lines <- all_lines[0:5]
limited_colors <- colors[0:5]
for (i in limited_lines ) {
cc <- cc + 1
cur_data <- subset(new_data, paste(SampleDate, StationID)==i)
sorted_data <- cur_data[order(cur_data$DepthValue),]
lines(sorted_data$ResultValue, sorted_data$DepthValue, type="l", lwd=5, col=limited_colors[cc])
}
axis(3)
axis(2)
box()
Thanks,
Rosh
Hi @Anonymous ,
You could start R learning from here: https://www.tutorialspoint.com/r/index.htm
Then, please refer to below documents to run R script in Power BI desktop.
Run R scripts in Power BI Desktop
Create Power BI visuals using R
Regards,
Yuliana Gu
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.