Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all, I'm a beginner in both python and power bi. I am trying to do horizontal bar chart in power bi but using python script. In my visualisation, sales will act as x-axis and subcategory will act as y-axis. However, the graph i made did not show the value for the sales(it looks weird). It did not start from 0 and the length of each data is not displayed.
This is my coding:
import matplotlib.pyplot as plt
import pandas as pd
data = dataset.Sales
df = pd.DataFrame(data,columns=[dataset.Sales], index =[dataset.Sub_Category])
df.plot.barh()
plt.title("Sales by Subcategory")
plt.ylabel("Sub_Category")
plt.xlabel("Sales")
plt.show()I tried to search online but there are no tutorial that specific for python in power bi, so I'm confused. Hope the expert can helps me:)
Hi @kilala ,
Although I am not an expert in python, I think these documents and video below may be helpful to you about creating python visuals in power bi desktop:
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @kilala
Please supply your dataset as a file
Phil
Proud to be a Super User!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 151 | |
| 130 | |
| 109 | |
| 79 | |
| 54 |