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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Power Query Using a Value from some previous step

Hello friends,

I have an Events table with a EventDate column.

I am doing some transformations in the table where I want to use Max(EventDate) for the whole table

How do I implement this without having to create another query?

Thank you

Michael

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

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.

 

z6.PNGz7.PNGz8.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
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

7 REPLIES 7
v-qiuyu-msft
Community Support
Community Support

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.

 

z6.PNGz7.PNGz8.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not 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

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.

 

Specializing in Power Query Formula Language (M)


@MarcelBeug wrote:

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.

 




Thnkas for your sharing @MarcelBeug Smiley Happy

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Great stuff,

Thanks, @MarcelBeug

Michael

MarcelBeug
Community Champion
Community Champion

Maybe something like this:

 

let
    Source = Events,
    MaxDate = List.Max(Source[EventDate])
in
    MaxDate
Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.