Forum Discussion
Data Model Retail Business (help!!)
Hi again,
Thank all for your support. Well i wasn`t clear enought on my first email, so will try to be more specific.
The final layout could be something like that, in diferent variables (value of stock, % of total stock, etc). But the vision will be always by store, by stock coverage and by total stores.
But the problem is with the total (red highlighted) on the pic above. And why?
Let see the following example of the same artcile (123) on several stores. The agregated data will give me 110 of stock for 110 of sales (30 days of stock, meaning "less than 50 days". However the is not real info.
I hope that i can be clear now. For that reason i have a new link for drive with the Power BI file as well as the "excel version":
https://drive.google.com/drive/folders/1Hx1dVA_SdO7-Wt1qCJ5GEhusSGhAh6KR?usp=sharing
Hi Anonymous,
Ok so probably not the most elegant Solution, but given that you are looking to infer dimension values I created 3 Columns for you in the F_Stock Table
Coverage Days =
var val = DIVIDE('F_Stock'[Stock Value], 'F_Stock'[Sales Value])*30
return
if(val = 0, 0, val)
Coverage Label =
SWITCH(
TRUE(),
'F_Stock'[Coverage Days] = 0, "No Sales",
'F_Stock'[Coverage Days] < 20, "Less than 20 Days",
'F_Stock'[Coverage Days] < 50, "Less than 50 Days",
"More than 50 Days"
)
//to be used as the sort by column for Coverage Label
Coverage Index =
SWITCH(
TRUE(),
[Coverage Days] =0, 4,
[Coverage Days] <= 20, 1,
[Coverage Days] <= 50, 2,
[Coverage Days] > 49, 3
)
You can then create a matrix like the following
You can also create the calc columns in Power Query by join the stock and sales tables together or adjust your source queries to get the stock and sales in the same table. but for now this seems to do the trick
hope this helps,
Richard
Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
- Anonymous6 years agoNot applicable
Hi Richard,
Thans for the reply. The table looks superb,
Is it possible to share the model? Im still very beginner so its dificult to me to understand the explantion just based on code.
Thanks!
- richbenmintz6 years agoResident Rockstar
Hi Anonymous,
Sure thing, link here, link to pbix.
In words essentially what i created where three calculated columns in the F_Stock Table
[Coverage Days] = stock / sales *30
[Coverage Label] = Case statement to assign correct label based on [Coverage Days] Value
[Coverage Index] = Case statement to assign correct order for [Coverage Label] based on [Coverage Days] Value This value is used as the sort by value for the [Coverage Label] Column
Once the Calculated Columns are available you can create the matrix you are looking for
- Anonymous6 years agoNot applicable
richbenmintz Uau this looks amazing!!
In onder to understand better the solution:
Is is possible to explain why did you make the [coverage days_], [coverage index_] and [coverage label_] also on the "F_sales"? Any reason or this is not used? From my understanding it seems not to be used by the model.
At the same time, it would be feasible to add to more columsn on the F_Stock with sales of "month n-1" and "month n-"2? And at the same time to adapt the coverage days formula from "stock / sales" to "stock / average sales (month n, n-1,n-2)" (i make a picture - below - in order to facilitate what im triying to say)
If i get your logical, i can adapt it to my reality.
Again and again...all my respect and thanks for your extraordinary help!
André