What are script visuals in Power BI?

Applies to: ✅ Power BI Desktop and Power BI service

Script visuals let you write code in a scripting language to create visualizations in Power BI reports. Power BI passes the fields you add to the visual to your script, runs the script, and displays the result on the report canvas.

Important

R and Python visuals in Power BI, including R-powered custom visuals, retire in May 2027. After retirement, R and Python visuals stop working in published reports in the Power BI service, including reports published before retirement. Future versions of Power BI Desktop won't include R and Python visuals, so you won't be able to add them to reports. Older versions of Power BI Desktop continue to render them locally by using the R or Python installation on your computer.

Before retirement, replace these visuals with a built-in Power BI visual, a custom visual, or an analysis in a Fabric notebook. For more information, see R and Python visuals retirement.

Available script visuals

The following table lists the script visuals available in Power BI.

Script visual Language Description
Python visual Python Create visuals with Python libraries such as pandas and Matplotlib.
R visual R Create visuals with R scripts and R packages.
R-powered custom visuals R Use R-based visuals from AppSource without writing R scripts.

How script visuals work

When you add fields to a script visual, Power BI creates a data frame from those fields and passes it to your script. The script draws a chart, and Power BI displays the chart as an image on the report canvas.

Script visuals respond to filters and highlighting from other visuals. Because the result is a static image, you can't select elements in a script visual to cross-filter other visuals, and script visuals don't show tooltips.

Retirement of R and Python visuals

R and Python visuals in Power BI, including R-powered custom visuals, retire in May 2027. This retirement applies only to R and Python visuals in interactive Power BI reports. Python scripts that you use in Power Query to populate tables aren't affected.

What changes

  • Power BI service: At retirement, all R and Python visuals stop working in published reports, including reports published before retirement.
  • R-powered custom visuals: Custom visuals that use R also stop working at retirement.
  • Older versions of Power BI Desktop: R and Python visuals continue to work locally by using the R or Python installation on your computer.
  • Future versions of Power BI Desktop: After retirement, R and Python visuals are removed, so you won't be able to add them to reports.

Find affected reports

No migration within your report recreates your exact R or Python visual. You must replace each visual with a different visualization before retirement.

  1. Review your reports for R and Python visuals. Save the scripts and a list of the packages they depend on.

  2. If you use Power BI Project (PBIP) format and Git-integrated workspaces, search your report definitions in source control to find built-in R and Python visuals across multiple reports. Look for these visualType values:

    • pythonVisual for Python visuals.
    • scriptVisual for R visuals.

    These values don't identify R-powered custom visuals. Review the custom visuals used in each report separately to identify any that depend on R.

  3. Let people in your organization know which reports are affected.

Replace the visual in your report

Rebuild the visualization with one of the following options:

Recreate the analysis outside the report

If you can't rebuild the visualization in a Power BI report, consider these alternatives:

  • Fabric notebooks: Recreate the analysis and visualization in a notebook. You might need to update your scripts for supported languages, libraries, and data access.
  • Fabric apps: Build an app for visualizations that you can't recreate in a Power BI report.

You can add both Fabric notebooks and Fabric apps to an org app to share them with your audience.