Forum Discussion
Power Query Using a Value from some previous step
- 9 years ago
Hi Anonymous,
Here is a sample Power Query for you to return MAX date of some previous steps. You can download attached .pbix to have a look.
Best Regards,
Qiuyun Yu
Hi Anonymous,
Here is a sample Power Query for you to return MAX date of some previous steps. You can download attached .pbix to have a look.
Best Regards,
Qiuyun Yu
- Anonymous9 years agoNot applicable
Thank you friends,
So I can just refference any previoust step and it remembers it?
Can I also join (merge) a current step with a table from let's say three steps before?
Thank you!
Michael
- MarcelBeug9 years agoCommunity Champion
Within a query, you can reference any other step, before or after the current step (beware of circular references though).
Power Query has the concept of immutability, meaning that data is becer changed; only new data is added.
So even if it looks like you are changing values (like with transforming column values), actually a new table is created.
And you can reference each of these versions by its step name.
That is: as long as you are in the query editor.
Once the query is ready and tables are re(loaded), the story is completely different: the entire query is evaluated as one unit and there is some smart logic behind it to do that efficiently.
E.g. with query folding, the entire query is evaluated as 1 SQL-statement that is fired to the database server.
Another example is code that may look highly inefficient on first sight, but appears highly effeicient while refreshing your data, e.g. if you want to use data from the previous row (not the previous step), it looks efficient to reference that row with an index number, but in practice it is way faster to create 2 index columns (one starting with 0 and the other with 1) and then merging the table with itself, joining on the different index columns, so you will have all required data on the same row.
- Anonymous9 years agoNot applicable