Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Hello Team,
I need help creating a new column in a table.
My tables are as follows:
Table Stock_main:
Date | Description | Balance |
28/01/2022 | Sugar | 5.00 |
28/01/2022 | Sugar | 4.00 |
28/01/2022 | Soda | 3.00 |
27/01/2022 | Chicken | 7.00 |
26/01/2022 | Chicken | 5.00 |
Purchasing table:
Date | des | Unit price |
03/01/2022 | Sugar | 10.00 |
01/01/2022 | Sugar | 8.00 |
01/01/2022 | Soda | 15.00 |
01/01/2022 | Chicken | 100.00 |
31/12/2022 | Chicken | 110.00 |
I need to vlookup the latest unit price in the table Stock_main from the purchasing table.
I appreciate your help.
Kind Regards,
Hasvine
Solved! Go to Solution.
@Anonymous , a new column in Stock_main
MAxx(filter(Purchasing, Purchasing[des] =Stock_main[Description] && Purchasing[Date] <=Stock_main[Date]) ,Purchasing[Date] )
Hi @Anonymous ,
It required bit of modelling where you need to create a calender table and join these table with it.
Then create a column as below:-
latest_unit_Price =
VAR _max_date =
CALCULATE (
MAX ( 'Purchasing table'[Date] ),
FILTER (
'Purchasing table',
'Purchasing table'[description] = Stock_main[Description]
)
)
RETURN
CALCULATE (
SELECTEDVALUE ( 'Purchasing table'[Unit price] ),
FILTER ( 'Purchasing table', 'Purchasing table'[Date] = _max_date )
)
Refer a file below:-
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @Anonymous ,
It required bit of modelling where you need to create a calender table and join these table with it.
Then create a column as below:-
latest_unit_Price =
VAR _max_date =
CALCULATE (
MAX ( 'Purchasing table'[Date] ),
FILTER (
'Purchasing table',
'Purchasing table'[description] = Stock_main[Description]
)
)
RETURN
CALCULATE (
SELECTEDVALUE ( 'Purchasing table'[Unit price] ),
FILTER ( 'Purchasing table', 'Purchasing table'[Date] = _max_date )
)
Refer a file below:-
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
72 | |
71 | |
65 | |
42 | |
42 |
User | Count |
---|---|
49 | |
42 | |
29 | |
28 | |
26 |