Dynamic Unit Price DAX Measure

radonwilson

Board Regular
Joined
Jun 23, 2021
Messages
50
Office Version
  1. 2019
Platform
  1. Windows
New Rate.xlsx
ABCDEFG
1Sales Table
2DateOrderIDSKUQtyAmountAmount BreakupSKU in Stocks
301-01-20241BT-0122002 X 100 = 2002 X 100 + 6 X 120 = 920
401-01-20242BT-0133202 X 100 + 1 X 120 = 3200 X 100 + 5 X 120 = 600
502-01-20243BT-0326602 X 330 = 6603 X 330 + 6 X 300 = 2790
602-01-20244BT-03412903 X 330 + 1 X 300 = 12900 X 330 + 5 X 300 = 1500
703-01-20245BT-0236003 X 200 = 6001 X 200 + 6 X 230 = 1580
803-01-20246BT-0224301 X 200 + 1 X 230 = 4300 X 200 + 5 X 230 = 1150
904-01-20247BT-0122403 X 120 = 3600 X 100 + 2 X 120 = 240
1004-01-20248BT-0111201 X 120 = 1200 X 100 + 1 X 120 = 120
1105-01-20249BT-0339003 X 300 = 9000 X 330 + 2 X 300 = 600
1205-01-202410BT-0236903 X 230 = 6900 X 200 + 2 X 230 = 460
Sheet1
Cell Formulas
RangeFormula
E4E4=200+120
E5E5=330*2
E6E6=330*3+300
E7E7=200*3
E8E8=200+230
E11E11=300*3
E12E12=230*3


New Rate.xlsx
IJKL
1Purchase Table
2SKUDateQtyRate
3BT-0101-12-20234100
4BT-0105-12-20236120
5BT-0202-12-20234200
6BT-0206-12-20236230
7BT-0304-12-20235330
8BT-0309-12-20236300
9BT-0112-12-20231090
Sheet1


New Rate.xlsx
IJK
11Current Stocks
12SKUQtyRate
13BT-011120
14BT-022230
15BT-032300
16BT-011090
Sheet1


1. I want to calculate the Amount dax measure as shown in Sales[Amount] col.
2. For the earliest transaction in the Sales Table, I want to look for the earliest SKU rate from the Purchase Table to calculate the amount.
3. There could be a situation where a multi-qty transaction of the same SKU would have different rates.
for example → Have a look at 2nd transaction. This transaction has 3 units and the amount is calculated as, for the first 2 units the rate is 100 and for the 3rd unit the rate is 120.
So the amount would be 2 X 100 + 1 X 120 = 320
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top