Forum Discussion
Stock Valuation
I have two tables, one with the average prices and one with the stock movements.
The price table is as follows
ID Date __articulo __id __nuevopmc
| 28 | 27/01/2021 | 2626 | 2,5297 |
| 57 | 29/01/2021 | 2626 | 2,6243 |
| 384 | 10/03/2021 | 2626 | 2,6791 |
| 600 | 05/04/2021 | 2626 | 2,6659 |
On the one hand I need to fill in the price for those months that there is no average price, for example in February I have no price. And this price has to be that of the last month with price, and in case there are several you have to take the one with the highest ID.
I already asked this in the forum and they answered me with the following formula, which for my needs was perfectly valid:
Everything works correctly until I have to value these stocks. Total stocks is not the multiplication of the sum of accumulated stock by the sum of last prices.
And taking into account that the articles are grouped into products, classes and subclasses .....
I leave the example .pbix in dropbox that I have created in power BI so you do not waste time creating a model and loading data.
https://www.dropbox.com/s/yyrkf6qej9nic59/Ejemplo%20Valoraci%C3%B3n.pbix?dl=0
Thank you very much in advance
Hi Syndicate_Admin ,
Please try:
Measure = var _a = SUMMARIZE('tArticulos',tArticulos[Articulos],"StockAC",[Stock Ac],"UltimpoPrecio",[Ultimpo Precio]) return SUMX(_a,[StockAC]*[UltimpoPrecio])Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- v-jianboli-msft
Community Support
Hi Syndicate_Admin ,
Please try:
Measure = var _a = SUMMARIZE('tArticulos',tArticulos[Articulos],"StockAC",[Stock Ac],"UltimpoPrecio",[Ultimpo Precio]) return SUMX(_a,[StockAC]*[UltimpoPrecio])Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Syndicate_Admin
Administrator
Let me try it on the real model and I confirm that everything is fine. At the moment the solution looks very good.
Thank you very much for raising it.
- Syndicate_Admin
Administrator
The proposed solution works correctly, thank you very much.