Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Solved! Go to Solution.
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
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.
@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
Best Regards,
Qiuyun Yu
Maybe something like this:
let Source = Events, MaxDate = List.Max(Source[EventDate]) in MaxDate
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |