Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hello all,
I need to calculate the Stock - Request difference in the Matrix table. I always see only 3 days, yesterday, today and tomorrow. I need to calculate the current stock situation. I need to count requests and subtract it from the current situation in stock. For example, for Material M001... for 12.11.2024 it will be 80-60 =20,
for 13.11.2024 it will be 60+100-80 = -80
for 14.11.2024 it will be 60+100+20-80 = -100.
Is it possible to do this calculation in DAX and use it in matrix?
Thank you
Solved! Go to Solution.
Hello,
thanks for your feedback. It gave me zero values everywhere.
But meanwhile i found a solution. This works for me:
Hi @Michael92 Try below code:
Diff =
VAR CurrentDate = MAX('Table'[Date])
VAR StockOnDate =
CALCULATE(
[Stock'],
'Table'[Date] = CurrentDate
)
VAR RequestsUpToDate =
CALCULATE(
[Request'],
'Table'[Date] <= CurrentDate
)
RETURN
StockOnDate - RequestsUpToDateWhere :
[Stock'] = SUM('Table'[Stock])
[Request'] = SUM('Table'[Request])
Output:
Considering Dataset:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Hello,
thanks for your feedback. It gave me zero values everywhere.
But meanwhile i found a solution. This works for me:
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 28 | |
| 23 | |
| 18 | |
| 18 | |
| 15 |
| User | Count |
|---|---|
| 49 | |
| 44 | |
| 43 | |
| 39 | |
| 32 |