Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
5. Menu Item Sales Table
My goal is this manual Excel example below:
08 08 2019 | 09 08 2019 | 10 08 2019 | 11 08 2019 | 12 08 2019 | 13 08 2019 | 14 08 2019 | 15 08 2019 | 16 08 2019 | 17 08 2019 | 18 08 2019 | |
Soup Roasted Pumpkin | |||||||||||
Soup Roasted Tomato | |||||||||||
Ciabatta Rolls W80 | |||||||||||
ZOOP Brown Large Bag S0.20 | |||||||||||
ZOOP Brown Roll Bag S0.02 | |||||||||||
Serviette 2 Ply |
Relationships are:
Ingredients (1-Many) Recipes
Menu Items (1-Many) Recipes
Menu Items (1-Many) Menu Items Sales
Date (1-Many) Menu Items Sales
Any advice?
Solved! Go to Solution.
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
Hi @Anonymous ,
Can you give me some samples of each tables? So that I can create a complete data model.
Best Regards,
Icey
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |