Forum Discussion
Using a few selections while modelling
- 7 years ago
Hi D3K
you can download the pbix file here: https://1drv.ms/u/s!AiiWkkwHZChHjx6QGS8z8QHzSMGu
also if you click on the link in my first post you can check online the new report
Hi D3K
you can download the pbix file here: https://1drv.ms/u/s!AiiWkkwHZChHjx6QGS8z8QHzSMGu
also if you click on the link in my first post you can check online the new report
- LivioLanzo7 years agoSolution Sage
No problem! Actually you can use this formula as well as it is more optimized and runs a bit faster:
Cost of Burger =
VAR IsIngredientFiltered =
ISFILTERED ( ApplyPercentageIngredients[Ingredient Name] )
RETURN
SUMX (
BurgersProducts,
-- get ingredient cost
VAR IngredientCost =
RELATED ( Ingredients[Cost] )
VAR PercToApply =
IF (
IsIngredientFiltered,
-- check if any ingredient is filtered
VAR GroupName =
RELATED ( Ingredients[Group Name] ) -- get group name
VAR IngredientName =
RELATED ( Ingredients[Ingredient Name] ) -- get ingredient name
RETURN
IF (
-- test is current ingredient is included in filter
CONTAINS (
VALUES ( ApplyPercentageIngredients[Ingredient Name] ),
ApplyPercentageIngredients[Ingredient Name], IngredientName
),
SWITCH (
GroupName,
"Green", [% Green Cost Change Value],
"Meat", [% Meat Cost Change Value],
"Bread", [% Bread Cost Change Value],
"Sauce", [% Sauce Cost Change Value],
"Other", [% Other Cost Change Value],
0
),
0
),
0
)
RETURN
[Quantity of ingredients] * IngredientCost
* ( 1 + PercToApply )
)- D3K7 years agoAdvocate II