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

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.

Reply
kingchad5
Helper I
Helper I

MIN value based on common ID number

I am looking to create a calculated column that returns the quote number that has the lowest price for each Opportinity.  

 

I have 2 tables.  

 

-  Table 1 = Opportunities

         -  Unique Opportunity ID

-  Table 2 = Quotes

         -  Each quote has a relationship to the Opportunity ID

 

Min Quote ID would be the calulated column.

 

Example Data

Table 1  Table 2  
Opportunity IDMin Quote ID Quote IDQuote PriceOpportunity ID
1ABC123 ABC1231001
2ABC126 ABC1242001
3ABC131 ABC1253001
4ABC132 ABC126502
5ABC135 ABC1272002
   ABC1286002
   ABC1296003
   ABC1305003
   ABC1312003
   ABC1328004
   ABC1339004
   ABC1349504
   ABC1351005
   ABC1362005
   ABC1373005

 

Please let me if you have any ideas.

 

Thanks,

 

Chad

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Try these calculated column formulas in the Opportunities table

 

Minimum Price

 

=MINX(RELATEDTABLE(Quotes),Quotes[Quote Price])

Created date for minimum price

 

=CALCULATE(MAX(Quotes[Created]),FILTER(CALCULATETABLE(Quotes),Quotes[Opportunity ID]=[Opportunity ID]&&Quotes[Quote Price]=[Minimum price]))

Quote ID

 

=LOOKUPVALUE(Quotes[Quote ID],Quotes[Opportunity ID],[Opportunity ID],Quotes[Quote Price],MINX(RELATEDTABLE(Quotes),Quotes[Quote Price]),Quotes[Created],[Created date for minimum price])

This solution will work even if you have 100 for AB124

 

Hope this helps.


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

View solution in original post

11 REPLIES 11

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.