Forum Discussion
zubairs
Helper I
5 years agoCost allocation by branch
Hi Guys, So this is a probelm that I've not been able to resolve for the longest of time. So I have two different data sets, one for revenue and one for cost. The data is calculated by geogra...
- 5 years ago
I think you want to multiply the cost by the fraction of routes in the current context over the total number of routes for that branch.
This should get you close:
Logistics SAP (Cost per route) = - [Logistics Cost (KSA)] * DIVIDE ( DISTINCTCOUNT ( Region_to_Van_mapping[Route] ), CALCULATE ( DISTINCTCOUNT ( Region_to_Van_mapping[Route] ), REMOVEFILTERS ( Region_to_Van_mapping[Route] ) ), 0 )In your code, DISTINCTCOUNT is just 1 for each of the routes since the route is part of the filter context for those rows (which is why I remove that filter in the denominator for my DAX).
zubairs
Helper I
5 years agoAlexisOlson thank you so much. I had been killing myself over this for the longest time now. You're a Godsent my friend!