This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Currently I am currently struggling with some DAX codes, and really have no idea where I should go. Appreciate any kind guidance – maybe some rough idea/functions/step- so I can try to code some solutions.
*Date format is MM/DD/YYYY
Let’s consider the data I have on hands.
Record is in monthly granularity. The dating of stock period is showing fixed Feb 1st, but it is providing the data as of current date Feb 21st, which is the latest refresh. The dating just remains unchanged. Currently there is no information for March 2024 Inventory.
Stock Period | Inventory On-Floor (MT) |
02/01/2024 | 30,000 |
Record is in daily granularity.
Outbound Date | Net Quantity (MT) |
02/01/2024 | 200 |
02/02/2024 | 100 |
02/15/2024 | 500 |
02/19/2024 | 600 |
02/27/2024 | 200 |
02/31/2024 | 100 |
03/01/2024 | 100 |
03/04/2024 | 300 |
03/05/2024 | 700 |
03/15/2024 | 400 |
Current Measures:
I tried computing below measures, as inventory data is only available as a single row, dating Feb 1st, 2024. The measure seems fine to me if the projection is within current month; however, when it comes to the future month projection, for e.g., Mar 2024, you can see that the projection is producing negative values due to no stock data yet.
Inventory Projection :=
VAR On-Floor Stock MTD =
Calculate (
SUMX ( Inventory, Inventory[Qty_Total] ),
DATESMTD ( 'DATE' [Date] )
)
VAR Outbound MTD =
Calculate (
SUMX ( Outbound, Outbound[Net_Qty] ),
DATESMTD ( 'DATE' [Date] )
)
VAR Result =
Inventory MTD - Outbound MTD
RETURN
Result
Based on the above measures, the result should look like below which is not favorable due to Mar producing negative value.
What I am looking for:
The way to compute DAX: If Mar 2024 stock data is not available, is there any chance we can use the projection at the end of Feb to compute projection for Mar 2024? As we are aiming to look into Mar and so on. Any other solution is also very much welcome.
Thanks @some_bih. I already have the date calendar and linked it with the inventory data.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |