title: Operations on multiple tables / datasets with Edit Queries and R in Power BI
body: <p>I have two tables <code>tbl_A and tbl_B</code> in a Power BI file that I'd like to transform and analyze using the <code>Run R Script</code> functionality in <code>Edit Queries</code>. </p>
  
  <p><a href="https://i.stack.imgur.com/GijHx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GijHx.png" alt="enter image description here"></a></p>
  
  <p>This would include handling missing values and joining the tables. However, when starting R, it seems I'm only able to do operations on one table at a time. This is because the <code>Run R Script</code> functionality only imports data from the table that is active when you click the <code>Run R Script</code> button. This data is then stored in the <code>dataset</code> variable.</p>
  
  <p><a href="https://i.stack.imgur.com/QHnVA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QHnVA.png" alt="enter image description here"></a></p>
  
  <p>If this is correct, it seems to me that the practical use of R` in Power BI would be very limited. I know I could join the tables <em>before</em> I unleash R. That would be a feasible solution for a simple case like this, but certainly not for more complex data structures. Any suggestions on how to do operations on <strong>multiple tables with R</strong> in Power BI?</p>