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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Find value from related table based on extra filter conditions

Hi,

 

I have been working with PBI for over 2 years, but really can't find a solution to a seemingly simple problem.

I have 2 tables: 'Customers' and 'Invoices' which are related 1 to * based on [CustomerID]. The 'Invoices' table has besides [CustomerID] also [InvoiceID], [Amount] and [InvoiceDate] as columns. I now want to add a calculated column to 'Customers' which has is the [InvoiceID] of the most recent [InvoiceDate] with an [Amount] > x . 

Any help on how to construct the DAX formula would be highly appreciated!

2 REPLIES 2
Arul
Super User
Super User

@Anonymous ,

It would be better if you share some sample data or the shcema?

Thanks,

Arul





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Anonymous
Not applicable

Hi @Arul , thanks for reviewing my question, and I indeed should have included some sample data to give a better picture of the problem. But I think I just solved it:


LatestInvoice =
var LatestInvoiceDate = CALCULATE(max(Invoices[InvoiceDate]),Invoices[Amount] > x)
var InvoiceNo = CALCULATE(SELECTEDVALUE(Invoices[InvoiceID]),Invoices[InvoiceDate]=LatestInvoiceDate)
return
InvoiceNo
 
At least it seems to work. I would have expected that a more elegant solution was possible (probably is) based on RELATEDTABLE, but I just couldn't make it work.
Anyway, sorry to have bothered you.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors