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.
Hi All,
I try to create a model for my logistics dept. There is logic behind:
1. I have initial stock [IS] amount and daily sales plan [SP], also as Desired Stock Amount [DS]
2. I place an [Order] with size [DS] - ([IS] - [SP]) = [DS] - [IS] + [SP]
3. When order arrives, I calculate [Fact Stock] = [IS] - [Fact Sales] + previous [Order].
To calculate next order, I have to use [Fact Stock] instead of [IS], but it depends on previous [Order] value.
Is it possible to calculate this model with measures?
I can do it in Excel with referencing prev. cells, but in DAX I cannot find a solution.
Solved! Go to Solution.
Hi Maxim,
Here is a dummy example of how this sort of calculation can be done.
The logic is to first calculate Cumulative Sales/Orders. The differences between daily Cumulative Orders are then daily Orders, and Stock Level = Initial Stock - Cumulative Sales + Cumulative Orders.
I followed this sequence of calculation through a series of measures:
Hopefully this can be adapted to your exact situation.
Notes:
Cheers,
Owen
Hi Holick
Please check out
http://community.powerbi.com/t5/Desktop/Recursive-calculation/td-p/97406
If this helps please give KUDOS.
Cheers
CheenuSing
Hi @CheenuSing
thank you for your suggestion
Unfortunately, I can't implement this for my case. But you link is very helpful and I've found few ideas there for my searches
Hi @hohlick,
You can try to use below methods if it works on your side.
1. Write a measure to calculate the previous order value.
2. If your table contain index column, you can use calculated column to calculate the Order, then you can use index column to get the previous Order.
Regards,
Xiaoxin SHeng
Hi @v-shex-msft
It is the first thing I tried to calculate. But I cannot implement it in my case...
It is like too much recursion for me
thanks anyway!
Hi Maxim,
Here is a dummy example of how this sort of calculation can be done.
The logic is to first calculate Cumulative Sales/Orders. The differences between daily Cumulative Orders are then daily Orders, and Stock Level = Initial Stock - Cumulative Sales + Cumulative Orders.
I followed this sequence of calculation through a series of measures:
Hopefully this can be adapted to your exact situation.
Notes:
Cheers,
Owen
Hi Owen,
could you please elaborate on the note regarding only adding orders, if the stock level is below the desired Stock?
I have tried to follow your example but my stock still keeps growing and growing.
Thank you so much for your help.
Torben
@OwenAuger ,
Thank you again so much for this example data.
Could I please ask you for a little more help?
I am trying to cap my stock at a certain value and only order more from production, if the stock is below the desired stock.
Any ideas?
Thanks,
Torben
Thanks for the messages! I've been away from the forums for a bit and just catching up on this thread.
Let me refresh my memory and get back to you.
Regards,
Owen
Hi @OwenAuger ,
my appologies to keep asking. But did you have a chance to look at this problem again?
Thank you so much,
Torben
I'm afraid things got away from me late last year, and I'm just now going through all the forum questions I have outstanding.
Are you still working on this, and if so it would be easier if you could share a PBIX illustrating the issue?
In the PBIX I created for the original question, I don't believe stock could increase without bound. In fact, if stock gets too high, my measures would create "negative" orders to bring it back down. There must be some difference in your model that allows stock to grow more than desired.
Regards,
Owen
Hi @OwenAuger
+100500 kudos!
It looks like it solved my issues. At least in dummy it looks as desired. I hope I could make other changes to fit my model.
Thank you a lot again!!! I was totally confused with all complexity of my excisting model and cannot see it with a freshe eye then.
Did you looked at Earlier DAX function
https://msdn.microsoft.com/en-us/library/ee634551.aspx?f=255&MSPPError=-2147217396
Hope this will get what you are looking for?
Thanks,
P
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
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 |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |