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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MP_T
New Member

Edit Python Get Data script without losing formatting

I have a Power BI report that gets data via a python script. The import script retrieves around 25 tables and supports a report of multiple pages. However, if I want to make small edit to the get data script, I can either delete the original data tables in Power BI or just import again. If I import again I get duplicate tables. Deleting and reimporting means I lose most or all of the column formatting and lose formatting in the visuals on settings like currency and how many decimal places to show. Is there a way that I can edit the python get data script without losing the table formatting and settings in the visuals? For example say the script is pulling in 25 tables and I want to amend it so it will pull in a 26th but the other 25 are unchanged, I don't want to have to manually change the formatting on the other 25 tables & all the visuals every time I modify the python script.

 

One solution could be to put a database (or flat files) in the middle so the python script populates the database (or flat files) and Power BI queries the database (or flat files) but I am looking for a direct solution. If it isn't possible any other workaround suggestions might also be useful.

 

I am new to Power BI but have quite a lot of python experience.

1 ACCEPTED SOLUTION
MP_T
New Member

Hi Daryl

 

Thanks for this link, it does look like it would help. In the end I went for the flat file approach. That means that I don't have to get all the python into a single script inside Power BI and I can keep all the coding on the python side. I'm sure there are other ways to do this and potentially better ways but at least the original issue was resolved.

View solution in original post

2 REPLIES 2
MP_T
New Member

Hi Daryl

 

Thanks for this link, it does look like it would help. In the end I went for the flat file approach. That means that I don't have to get all the python into a single script inside Power BI and I can keep all the coding on the python side. I'm sure there are other ways to do this and potentially better ways but at least the original issue was resolved.

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @MP_T , I was wondering if the following blog post helps you understand how Power BI approaches data types when expanding tables:

Chris Webb's BI Blog: Setting Data Types On Columns Containing Table Values In M Chris Webb's BI Blo...

 

There are some additional changes that you can do make this more dynamic if the columns in the Python results are changing.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors