Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 216047

LookUpValue Function -- Error

$
0
0

Dears:

 

I have a table, named "Receptions", where material receptions information from multiples supplier and items are stored.

For trazeability issues, every supplier batch needs a internal batch. Of course we try to limit the amount of batches, but sometimes it happens.

In the below (and simple) example you can see the Product 1 has been received last time on July 06th, but two batches were received from Supplier 1.

 

Receptions Table(Fact Table)     
ProductDatePriceBatchSupplier batchSupplierQuantity
Product 106/07/20162,45Lot-001Batch 2016-1Supplier 1250
Product 106/07/20162,47Lot-002Batch 2016-2Supplier 1250
Product 105/04/20162,48Lot-003Batch 2016-3Supplier 1500

 

This is how the table I have created looks like in PowerBI.

 

Receptions Summary Table

Supplier NameFull NameTotal Purchases (%) FamilyLast PurchaseLast Purchase PriceTotal AmountAverage of Unit Price € (Exchange Insurance)
Supplier 1Product 181,59%06/07/2016 0:00 181652,52
Supplier 1Product 228,30%21/06/2016 0:00 1669410,28
Supplier 1Product 399,69%23/05/2016 0:00 160001,81
Supplier 1Product 454,86%16/03/2016 0:00 150701,23
Supplier 1Product 587,19%19/07/2016 0:00 129652,96
Supplier 1Product 625,92%06/07/2016 0:00 102534,6
Supplier 1Product 716,21%20/07/2016 0:00 99593,55
Supplier 1Product 811,30%04/02/2014 0:00 73151,8
Supplier 1Product 933,75%21/01/2016 0:00 70003,72
Supplier 1Product 10100,00%19/07/2016 0:00 58502,51
Supplier 1Product 1172,16%13/05/2016 0:00 53824,1

 

By using MAXA function I can find the Last purchase date.

 

What I can't is "the last price" for that date. In this case 2,47.

 

I was investigating about Lookupvalue but this functions seems to have problems when two values are found (my case, two receptions at 06 th of July with different price).

 

"if several rows in your table match your criteria, then VLOOKUP in Excel will only return thefirst (or last) match. On the contrary, LOOKUPVALUE in DAX may return an error if several rows match your criteria. This will occur if [OutputColumn] does not contain the same value for all matching rows".

 

Source: https://thedataspecialist.wordpress.com/2013/02/16/equivalent-of-vlookup-in-daxpart-i/

 

Please I need your help to find the right expression to give me the "maximum value of price" for the "last purchase date".

 

Regards,


Viewing all articles
Browse latest Browse all 216047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>