In Power BI you can use Python - similarly to R script It can be done in few steps:

Data source definition

In queries

In visuals