Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Starting Position:
Goal:
Approach:
Problem:
NB: I already tried DATESBETWEEN but failed to keep the start date dynamic
Check
https://community.powerbi.com/t5/Desktop/Inventory-Calculation/td-p/138540
https://community.powerbi.com/t5/Desktop/Calculate-inventory-on-a-given-date/td-p/71699
I have already checked out these threads, but the issue I'm faced with is a bit different:
Based on an overview of the current balances (with specific date X) I need to reconstruct the past balances (daily) by creating a measure that's subtracting the sum of purchases and adding the sum of sales that happened between each day and the date X
If date if fixed by a slicer then
Inventory till date = Var _min_date_for_inventory = CALCULATE(maxx(all('Date'[Date Filer]),'Date'[Date Filer])) Var _Todays_date=CALCULATE(maxx(ALLSELECTED('Date'[Date Filer]),'Date'[Date Filer])) Var _inventory= CALCULATE(sum(Sales[Sales Amount]),all(Sales[Sales Date].[Date]),Sales[Sales Date]<=_min_date_for_inventory) Var Sale_till_tody =CALCULATE(sum(Sales[Sales Amount]),filter(sales,Sales[Sales Date]<=maxx(Sales,Sales[Sales Date].[Date]))) Var purchase_till_tody =CALCULATE(sum(Sales[Sales Amount]),filter(sales,Sales[Sales Date]<=maxx(Sales,Sales[Sales Date].[Date]))) return _inventory -Sale_till_tody+purchase_till_tody
_inventory is optional , can be removed
will it work if the end date is fixed but the start date is variable?
Because the goal is to have a bar chart with the days on the x-axis which are the respective start dates.
For example:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |