Forum Discussion
Tips for solving a Business Case - INVENTORY ALLOCATION TO CUSTOMER DEMAND
- Anonymous2 years ago
Hi NewNow ,
Of course, it is possible to improve the column definitions for calculations by using variables instead of EARLIER functions.
For exampleSubcategory Sales Rank = COUNTROWS( FILTER( Subcategory, EARLIER(Subcategory[Subcategory Sales]) < Subcategory[Subcategory Sales] ) ) + 1The CurrentSubcategorySales variable stores the Subcategory Sales column value in the current row context, and the RETURN expression uses it in the modified filter context.
Subcategory Sales Rank = VAR CurrentSubcategorySales = Subcategory[Subcategory Sales] RETURN COUNTROWS( FILTER( Subcategory, CurrentSubcategorySales < Subcategory[Subcategory Sales] ) ) + 1More details can be found in the documentation:Use variables to improve your DAX formulas - DAX | Microsoft Learn.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I forgot to mention that this scenario it's just for 1 sku (1 SKU with multiple Inventory storage point and with multiple Customer Demand).
In the Scenario i'm trying to solve i have multiple SKU, each one with with multiple Inventory storage point and with multiple Customer Demand