Using multiple datasets in Python and R script steps
You may have noticed how each query in Power Query has its own queue of transformation steps, leading from the initial data to the final dataset in the desired form. You may need to add a Python or R script step that uses a function to which you need to pass two dataframes as parameters to a query.Assuming I have the two queries query_A
and query_B
, which return the two datasets to be used as parameters for the above function, how do I reference the result of query_B
in my script if I’m adding the script step to query_A
?There are several ways to do this. Let's see them.
Applying a full join with Merge
The first trick that comes to mind for any analyst who is used to dealing with data is to apply a full join between the two datasets and thus generate a third dataset on which to apply the script step. Within the script step, the reverse merge transformation is applied, that is, separating the columns of the two original datasets...