Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Stock usage over time

Hi everyone, I am trying to calculate stock usage per day to make ordering easier. I have several tables: 1. Ingredients 2. Menu Items 3. Date Table 4. Recipes Table               ...
  • Icey's avatar
    6 years ago

    Hi Anonymous ,

     

    Maybe you can try this:

    1. Do not create relationships using 'Menu Table', and create 'Many-to-Many' relationship between 'Recipes Table' and 'Menu Item Sales Table' instead.

    2. Create a measure.

    Ingredient Sales =
    SUMX (
        ItemSales,
        CALCULATE (
            MAX ( ItemSales[Qty Sold] ),
            ALLEXCEPT (
                'Granular Recipes',
                'Granular Recipes'[Item Name],
                'Granular Recipes'[Ingredient]
            )
        )
            * CALCULATE (
                MAX ( 'Granular Recipes'[Quantity] ),
                ALLEXCEPT ( ItemSales, ItemSales[Date], ItemSales[Item Name] )
            )
    )

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.