Thank you very much for your help! For a better explanation please see the comments bellow:
We have a data warehouse containing all stock data on a daily basis with handling unit numbers, stock status. In the stock data warehouse we have no line if there is no stock, that is why we have put in the data table.
As a company we would like to know how good we follow our safety stock rules :-).
Regarding Question 1:
We have multiple lines per item and day based on stock status and handling units - therefore we need to sumstock per Key (status = available). Furtheremore we like to know how often (for example in a certain month) we did not fulfill the defined safety stock (including days with no stock).
Regarding Question 2
Yes, you are right sorry for the confusing example. Is it possible to show the - 200 for key 101ABC (Orange) on August 2nd as well?
I will continue to search for a solution to your problem
With your database, is it possible to use Power Query to transform the data or the change can only be made with DAX ?
Power Query is no option because this element becomes a part of an exisiting report which is already quite complex (many sources, DWH contains 40 million rows)
Because you don’t have an Item Table that includes all the possible keys in your model, I had to separate my measure in two tables.
You have keys that are in dim_Stock and not in dim_Safety_Stock and keys that are in dim_Safety_Stock and not in dim_Stock.
So the first table (_Table1) calculates the stock, available stock, difference… for the items in dim_Safety_Stock.
The second table (_Table2) calculates all the necessary indicators for the item in dim_Stock that we can’t find in dim_Safety_Stock.
With the function CROSSJOIN, I was able to add all the possible dates and to force the indicators to 0 if there is no value of stock.
Hi @Franz, we’ve noticed that no response has been received from you since August 31. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.
Good Morning Joaly,
please excuse my deleyed answer, we successfully implemented the soultion in our big model (validation not so easy) , so i have exactly what I need.
many thanks again for your effoert quick help.
kind regards
Franz