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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Python and Power BI

I will transform invoice data inside powerBI to then analyze this. The invoices have several sections to show where the sums in the total amount come from. When I try to retrieve the invoice data, powerBI only manages to retrieve the bottom line with the KID number, but not the total amount or the various subtotals. My idea was to use python to clean up the invoice and create a format that powerBI can read, so that all the data comes with it. But here I need your help, how do I do this? Since I am a summer student in a company, I have limited access and am unable to connect vscode to powerBI. How should I transform the documents?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

 

You can perform data cleansing and perform advanced data shaping and analysis on a dataset using Python directly from within the Power Query editor in Power BI Desktop.

For example:

import pandas as pd
completedData = dataset.fillna(method='backfill', inplace=False)
dataset["completedValues"] = completedData["SMI missing values"]

You can find the procedure and related restrictions in the official documentation below, hopefully it will help you:

Use Python in Power BI Power Query Editor - Power BI | Microsoft Learn

This is the related document, you can view this content:

powerbi - Power BI: How to process/clean string data using Python? - Stack Overflow

https://stackoverflow.com/questions/51947441/power-bi-how-to-use-python-with-multiple-tables-in-the-power-query-editor/51947461#51947461

random - How to make a reproducible data sample in PowerBI using Python? - Stack Overflow

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @Anonymous ,

 

You can perform data cleansing and perform advanced data shaping and analysis on a dataset using Python directly from within the Power Query editor in Power BI Desktop.

For example:

import pandas as pd
completedData = dataset.fillna(method='backfill', inplace=False)
dataset["completedValues"] = completedData["SMI missing values"]

You can find the procedure and related restrictions in the official documentation below, hopefully it will help you:

Use Python in Power BI Power Query Editor - Power BI | Microsoft Learn

This is the related document, you can view this content:

powerbi - Power BI: How to process/clean string data using Python? - Stack Overflow

https://stackoverflow.com/questions/51947441/power-bi-how-to-use-python-with-multiple-tables-in-the-power-query-editor/51947461#51947461

random - How to make a reproducible data sample in PowerBI using Python? - Stack Overflow

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.