cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
D3K Regular Visitor
Regular Visitor

Re: Using a few selections while modelling

@LivioLanzo

 

It's absolutely AWESOME! I can't believe!

My knowledges definately wasn't enough for that system Smiley Happy

 

THANK YOU so much! Great!

D3K Regular Visitor
Regular Visitor

Re: Using a few selections while modelling

@LivioLanzo

 

Want to thank you one more time for even noted hints in DAX formulas Smiley Happy

Super User
Super User

Re: Using a few selections while modelling

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 )
    )

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

D3K Regular Visitor
Regular Visitor

Re: Using a few selections while modelling

@LivioLanzo

 

Got you! Thanks, will try to implement it into the report Smiley Happy