Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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
User | Count |
---|---|
140 | |
113 | |
104 | |
76 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |