Forum Discussion
Inventory risk based on expiry dates
- 1 year ago
Hi GGerritsen ,
Thank you for being a part of Microsoft Fabric Community Forum!Thanks so much for sharing all the details. At this point, since we’ve explored a lot of possibilities and the issue seems to go a bit deeper, I think the best next step would be to raise a support ticket with Microsoft. That way, the support team can take a closer look with the right tools and internal access.
To raise a support ticket for Fabric and Power BI, kindly follow the steps outlined in the following guide:
How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.
Regards,
Menaka Kota.
Hi GGerritsen ,
Can you please share your DAX measure here.
Thank you,
Menaka Kota.
The DAX Formula is what I'm trynig to get. I have tried a number of different versions but no luck so far.
At This moment I'm partially there.
in the forecast table I have the intervsall calculation.
then in My ionventory file I have the calculations to see how much the forevcast is between the expiry dates.
I still need to calculate the risk on expired product that will be left based on these numbers
In addition this seems a lot of calulations, specially if i have a prodcut with a lot oif dirrent batch numbers / expiry date, there muct be something i can do fast. Right now excel (slow excel) is able to run all this in a symple formula. My goal is to have this run smoother and faster.
Hope this is the info you were loking for, if not let me know.
G.
- GGerritsen1 year ago
Helper I
Good morning, I will log the ticket and post the results here to keep everything together, once it has been resolved I will mark solution as Accept
- v-menakakota1 year ago
Community Support
Hi GGerritsen ,
The measure is getting error which is Mdx error in excel, you can try this write this in excel
CalculatedColumn =
VAR RiskAmount = [Forecast] * [Months left Inventory]
VAR SumForecast = CALCULATE(SUM(TableName[Forecast]), TableName[Item No.] = EARLIER(TableName[Item No.]))
VAR SumRisk = CALCULATE(SUM(TableName[Risk]), TableName[Item No.] = EARLIER(TableName[Item No.]))RETURN
IF (
[Expiry date] < TODAY(),
[Forecast],
IF (
SumForecast > RiskAmount,
SumForecast - SumRisk - RiskAmount,
0
)
)And also use switch function instead of nested if for the below one:
RETURN
SWITCH(
TRUE(),
CurrentMonth < FirstExpiry, "Before First Expiry",
CurrentMonth >= FirstExpiry && CurrentMonth < SecondExpiry, "Between First and Second Expiry",
CurrentMonth >= SecondExpiry && CurrentMonth < ThirdExpiry, "Between Second and Third Expiry",
CurrentMonth >= ThirdExpiry, "After Third Expiry",
"Unknown"
I think by changing these may help to run them faster.
Thank you and Regards,
Menaka Kota. - GGerritsen1 year ago
Helper I
Thank you for your help so far, but I think I have made too many changes thst nothing is working anylonger. I am starting over, hoping this help
I have 2 files.
Forecast data has weekly expected sales
Inventory data has Qty and expiry dates.
(In "real life" files have mulitple items / expiry dates but for this I want to keep it symple)
I need to run a report that shows what my risk is for the items by the time it reached the expiry date.
example, Expiry date August 04 2025, I will sell untill this date, there will be x cases at risk.
After August 04, I will start selling the next lot (September 02) there will be x cases at risk.
and only after September 02 (or if I sell the lot that expires Sept 02 => whichever comes first) I wills start selling the lot that expires November 05.
Currently doing this in Excel, but based on the number of items / lots this is getting cumbersome, thinking BI is a better option, and I would be able to share this information better with the sales group to ensure they are pushing the proudcts that need to sell first.
Open to sugestions.
G.
- v-menakakota1 year ago
Community Support
Hi GGerritsen ,
Once try these
cumulative forecast measure:Cumulative Fcst :=
CALCULATE(
SUM(Forecast[Fcst]),
FILTER(
ALL('Date'),
'Date'[Date] <= MAX('Date'[Date])
)
)
Create a calculated table to simulate forecast consumption by expiry:
InventoryRisk =
VAR LotTable =
ADDCOLUMNS(
Inventory,
"FcstUntilExpiry",
CALCULATE(
SUM(Forecast[Fcst]),
FILTER(
Forecast,
Forecast[Item] = EARLIER(Inventory[Item]) &&
Forecast[Date] <= Inventory[Expiry Date]
)
)
)
RETURN
ADDCOLUMNS(
LotTable,
"RiskQty", [Qty] - [FcstUntilExpiry]
) - GGerritsen1 year ago
Helper I
Getting stuck at the error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."
- v-menakakota1 year ago
Community Support
Hi GGerritsen ,
Your DAX will return a table with multi columns, it couldn't be a measure.
Therefore you need to use this expression on (Create new table)
If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.
- v-menakakota1 year ago
Community Support
Hi GGerritsen ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
- GGerritsen1 year ago
Helper I
hello, sorry, Friday was a travel day, was out of office and working from a different plant last week, just catching up on everything and will work at this again during the week.
G.
- GGerritsen1 year ago
Helper I
Moved it into it's own table, here are the results
for the lot expiring August 04, current inventory 6,174 units
Cumulative forecast between now and August 04 3,329 units
My expected result would have been risk of 6174-3329 = 2845 units
The second lot 2142 units
forecast between Augsut 04 anbd Sept 02 = 3,994 - 3,329 = 665 units
Risk for second lot is 2,142 units - 665 sales = 1,477 units risk.
I'm sure I am doing something wrong that is giving me the different numbers, just can't find where it goes off.
G.
- v-menakakota1 year ago
Community Support
Hi GGerritsen ,
Thank you for being a part of Microsoft Fabric Community Forum!Thanks so much for sharing all the details. At this point, since we’ve explored a lot of possibilities and the issue seems to go a bit deeper, I think the best next step would be to raise a support ticket with Microsoft. That way, the support team can take a closer look with the right tools and internal access.
To raise a support ticket for Fabric and Power BI, kindly follow the steps outlined in the following guide:
How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.
Regards,
Menaka Kota.
- v-menakakota1 year ago
Community Support
Hi GGerritsen ,
We are following up once again regarding your query. Could you please confirm if the issue has been resolved through the support ticket with Microsoft?
If the issue has been resolved, we kindly request you to share the resolution or key insights here to help others in the community. If we don’t hear back, we’ll go ahead and close this thread.
Should you need further assistance in the future, we encourage you to reach out via the Microsoft Fabric Community Forum and create a new thread. We’ll be happy to help.
Thank you for your understanding and participation.