Forum Discussion
Stock usage over time
- 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.
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.
Icey ,
Thank you SO much - that worked perfectly.
If I should post this as a new query, let me know, but I'm trying to work out the average usage of specific ingredients (broken down using a slicer) per weekday. When I try an AVERAGEX function it returns the average for the sum of all the Sundays, for example, meaning it shows the usage for the Sundays for the whole month instead of an average Sunday.
Any clues?
Regards,
Tom