Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi everyone,
I'm trying to find a solution for the following issue.
I have two tables:
Salesinvoice (salesdate, articlenumber)
Purchaseinvoice (purchasedate, articlenumber, purchaseprice)
I'm trying to create a measure in Salesinvoice that, based on the salesdate, selects the latest purchaseprice.
So, the salesdate >= purchasedate && MAX(purchasedate).
Can someone please help me?
Solved! Go to Solution.
Hi @Anonymous
You may use below measure. Show the simplified sample as below:
LatestPrice =
CALCULATE (
MAX ( Purchaseinvoice[purchaseprice] ),
TOPN (
1,
FILTER (
Purchaseinvoice,
Purchaseinvoice[articlenumber] = MAX ( Salesinvoice[articlenumber] )
&& Purchaseinvoice[purchasedate] <= MAX ( Salesinvoice[salesdate] )
),
Purchaseinvoice[purchasedate], DESC
)
)
Regards,
Cherie
Hi @Anonymous
You may use below measure. Show the simplified sample as below:
LatestPrice =
CALCULATE (
MAX ( Purchaseinvoice[purchaseprice] ),
TOPN (
1,
FILTER (
Purchaseinvoice,
Purchaseinvoice[articlenumber] = MAX ( Salesinvoice[articlenumber] )
&& Purchaseinvoice[purchasedate] <= MAX ( Salesinvoice[salesdate] )
),
Purchaseinvoice[purchasedate], DESC
)
)
Regards,
Cherie
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.