Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
75 | |
53 | |
37 | |
32 |
User | Count |
---|---|
99 | |
56 | |
50 | |
43 | |
40 |