Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
I need to create a calculated column 'Inventory_value' that calculates for each PV/product/date the inventory as follows:
The inventory of the day before for that PV/product + qty_em + qty_ref- qty_ven
If the inventory of the day before is not present, it becomes 0.
So far I've only made this and it doesn't work, because I always get a big value like as if its summing up all the rows together
inventory_value =
var current_dt = rimanenze_pv_day_nonoil[dt]
var product = rimanenze_pv_day_nonoil[cost_prod]
var inventory_before =
CALCULATE(
SUM(rimanenze_pv_day_nonoil[em_total_value]),
FILTER(
rimanenze_pv_day_nonoil,
rimanenze_pv_day_nonoil[dt] = current_dt - 1
)
)
var inventory_true = inventory_before + rimanenze_pv_day_nonoil[em_qty] + rimanenze_pv_day_nonoil[rett_qty] - rimanenze_pv_day_nonoil[ven_qty]
var result =
IF(
ISBLANK(inventory_before),
0,
inventory_true
)
return
resultThe idea is that it returns that sum for each row, not all summed together. Does anyone have a clue on how to fix this? All the values are within the same table.
Solved! Go to Solution.
Thank you, I used the additional detail as an AND measure like so
you did not define the product?
inventory_value =
var current_dt = rimanenze_pv_day_nonoil[dt]
var product = rimanenze_pv_day_nonoil[cost_prod]
var inventory_before =
CALCULATE(
SUM(rimanenze_pv_day_nonoil[em_total_value]),
FILTER(
rimanenze_pv_day_nonoil,
rimanenze_pv_day_nonoil[cost_prod]=product,
rimanenze_pv_day_nonoil[dt] = current_dt - 1
)
)
var inventory_true = inventory_before + rimanenze_pv_day_nonoil[em_qty] + rimanenze_pv_day_nonoil[rett_qty] - rimanenze_pv_day_nonoil[ven_qty]
var result =
IF(
ISBLANK(inventory_before),
0,
inventory_true
)
return
result
Thank you, I used the additional detail as an AND measure like so
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 14 | |
| 11 | |
| 9 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 28 | |
| 20 | |
| 19 | |
| 17 | |
| 12 |