This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello, I'm trying to insert a python visual I created (and works outside power BI), and insert into a power bi python visual. This is a gantt chart. When I try to run it it gives me the following error message:
Error Message:
Python script error.
TypeError: unsupported operand type(s) for -: 'str' and 'str'
During handling of the above exception, another exception occurred:
TypeError: unsupported operand type(s) for -: 'str' and 'str'
I suspect it is treating the date columns as a string. In the data model however, the dates are formatted as short dates and have the data type date. Can anyone explain what might be happening?
A piece of the code where i expect the error to be happening:
Solved! Go to Solution.
My bad, I realized that doing data editing is not wise inside the python script. You should edit the data in the ways you need with dax calculations and then feed those into the python visual!
My bad, I realized that doing data editing is not wise inside the python script. You should edit the data in the ways you need with dax calculations and then feed those into the python visual!
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.