0

I already read this post before: Power BI: How to use Python with multiple tables in the Power Query Editor?

I'd like to do something like this inside PBI:

import pandas as pd
import numpy as np

proc = cad_processo
moeda = tab_moeda_data

def name_of_the_function(proc, moeda):
   df = code...
   return df

Now I'll explain more in-depth what I'm doing:

I'm in a table called cad_processo, I need to apply a very complex function to create a column in cad_processo, but in order to create this new column, I need another table called tab_moeda_data.

I tried what was explained in the post I quoted before, but I wasn't able to achieve nothing so far.

In theory it's simple, import 2 tables and apply a function to create a new column, but I'm not being able to import this second table (tab_moeda_data) into the cad_processo to apply the function.

Image

*I know that cad_processo is called dataset in this case I only need to import another table (tab_moeda_data) to apply the function, that's it.

Can anyone help me?

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67
Comune
  • 13
  • 5

1 Answers1

0

This is a feature that the UI doesn't support, so you have to use the Advanced Editor.

But you can simply pass additional Tables to Python.Execute, eg

MainTable = ...,
RunPythonscript = Python.Execute(pythonScript,[dataset=MainTable, otherTable=OtherTable]),

And they will be available as additional pandas DataFrames in your script.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67