Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
@Anonymous , a new column in Stock_main
MAxx(filter(Purchasing, Purchasing[des] =Stock_main[Description] && Purchasing[Date] <=Stock_main[Date]) ,Purchasing[Date] )
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
94 | |
88 | |
32 | |
28 |
User | Count |
---|---|
153 | |
101 | |
82 | |
63 | |
52 |