Forum Discussion

NewNow's avatar
NewNow
New Member
2 years ago
Solved

Tips for solving a Business Case - INVENTORY ALLOCATION TO CUSTOMER DEMAND

Hello, i need to solve the following Business Case: i have a Supply - Inventory Table and Demand - Customer Table   I need to create a PBI model to solve the allocation problem between Demand An...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi NewNow ,

     

    Of course, it is possible to improve the column definitions for calculations by using variables instead of EARLIER functions.


    For example

    Subcategory Sales Rank =
    COUNTROWS(
    FILTER(
    Subcategory,
    EARLIER(Subcategory[Subcategory Sales]) < Subcategory[Subcategory Sales]
    )
    ) + 1

     

    The 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]
    )
    ) + 1

     

    More 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.