Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
WOLFIE
Helper I
Helper I

Cannot plot the Plotly visual using Python in PBI desktop

Hi,

 

Could you please advise how to resolve this error? My Python script works fine in Databrics, however, when I run it in Power BI it opens up the visual in the browser window instead and gives me this error:

WOLFIE_0-1720080456937.png

Here is the code:

import pandas as pd
import plotly.express as px

# Create a DataFrame
dataset = pd.DataFrame(dataset)

# Convert 'End Date' and 'Start Date' to datetime objects
dataset['End Date'] = pd.to_datetime(dataset['End Date'])
dataset['Start Date'] = pd.to_datetime(dataset['Start Date'])

# Calculate the difference in days between 'End Date' and 'Start Date'
dataset['diff'] = (dataset['End Date'] - dataset['Start Date']).dt.days

# Reverse the DataFrame to match the reversed y-axis labels
dataset = dataset.iloc[::-1].reset_index(drop=True)

# Create a figure and axis
fig = px.timeline(dataset, x_start="Start Date", x_end="End Date", y="Event Description", color="Group Name",
                  hover_data={"Start Date": "|%Y-%m-%d", "End Date": "|%Y-%m-%d"},
                  labels={"Start Date": "Start Date", "End Date": "End Date"})

# Update layout
fig.update_layout(
    title='Timeline',
    xaxis=dict(
        title='Date',
        tickformat='%Y'
    ),
    yaxis=dict(
        title='Group Name'
    )
)

# Show the figure
fig.show()
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You cannot bring your own renderer, you need to use the default renderer.

 

Create Power BI visuals using Python in Power BI Desktop - Power BI | Microsoft Learn

View solution in original post

3 REPLIES 3
WOLFIE
Helper I
Helper I

This is annoying as Plotly is the only option that provides interactive visual 😕 Thanks for your response.

If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41

lbendlin
Super User
Super User

You cannot bring your own renderer, you need to use the default renderer.

 

Create Power BI visuals using Python in Power BI Desktop - Power BI | Microsoft Learn

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.