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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
kent-culpepper
Frequent Visitor

List.Max function @ Power Query M (Inline Subquery)

I am trying to Add a Column ("Max_Quote_Date") that returns the Max Date of another Column ("Quote_Date") with 2 conditions ("Investment_Key","Month_Date"), using the following expression;

 

 

#"Added Max Quote Date" = Table.AddColumn(#"Filtered Rows1", "Max_Quote_Date", each 
    List.Max(#"Filtered Rows1"[Quote_Date], 
            [Investment_Key] = #"Filtered Rows1"[Investment_Key] and [Month_Date] < #"Filtered Rows1"[Month_Date]
        )
    )

 

 

It doesnt seem to be applying both conditions. And the performance is very slow.. I am sure there is a more efficient method.

 

Below is a visual illustration of what i am trying to achieve;

kentculpepper_0-1705711414501.png

 

I liken this to an "inline subquery" in terms of SQL.

 

Any ideas?

 

Thanks much for your support.

5 REPLIES 5
Ahmedx
Super User
Super User

firstly, the conditions are unclear, try to explain in words what you want and what conditions must be met
secondly, share data that will help you

Where 

[Investment_Key] = #"Filtered Rows1"[Investment_Key] and [Month_Date] < #"Filtered Rows1"[Month_Date]

[Investment_Key]  this is Value
 #"Filtered Rows1"[Investment_Key]  this is List
why do you want to compare the value with the List🙄

so I ask what do you need?

If we reference the visual, I am indicating that I want to return (in a new column) the yellow-shaded value where it is currently null.

 

Which means I want to find the Max(Quote_Date) Where the Investment_Key = the Prior Step Investment Key and the Month_Date < the Prior Step Month_Date.

 

9/30/23 = Max(Quote_Date) Where Investment_Key = Aeva Tech And Month_Date < 10/31/23.

Ashish_Mathur
Super User
Super User

Hi,

If you are amenable to the idea of solving it with a calculated column DAX formula, then share some data to work with (in a format that can be pasted in an MS Excel file).


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.