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

How do I make a calculating conversion table in CDS/PowerApps?

Excuse me for the extremely novice level (I don't even know how to form the question quite right!):

I am converting an Excel spreadsheet I made into a PowerApps "recipe calculator" (using CDS), but don't know quite where to begin.

How I imagine the solution is two tables: Recipes and Base Ingredients. The recipe would be the unique name, ingredient1, ingredient2, ingredient3, (etc) with the values in percentages. The Base Ingredients would be Ingredient1, ingredientA, ingredientB, ingredientC, (etc)... again, with the values in percentages.

So, basically, "Ingredient1" is made up of 75% ingredientA, 25% ingredientB, "Ingredient2" is made up of 10% IngredientB and 90% IngredientC. The recipe "Unique123" is made up of 50% "Ingredient1" and 50% "Ingredient2". The calculator would return "IngredientA: 37.5%", , "IngredientB: 17.5%", and "IngredientC: 45%".

The actual calculator would be a dropdown that selects the recipe (displaying the name) and a list of the TOTAL amount (in percent) of the A-Z ingredients.

The issue I'm running into is how to link the two tables together to perform the calculation. In Excel, I just did the calculation in the field of the Base Ingredients.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

Hi @Manorexia ,

1)I suggest you create 2 tables(Recipes and Base Ingredients)

table1: Base Ingredients( what is "Ingredient1","Ingredient2",... made up of)

The structure of the table is：

IngredientID(text)          A (floating point number)           B          C

Ingredient1                    0.75                                           0.25

Ingredient2                                                                       0.1         0.9

table2: Recipes( what is recipe "Unique123" made up of)

The structure of the table is：

recipeName     Ingredient1        Ingredient2

Unique123         0.5                      0.5

2)insert a drop down, a button, a datatable.

Set the drop down's Items: Recipes      Value:recipeName

Set the button's OnSelect:

`ClearCollect(test,{recipe:Dropdown2.Selected.recipeName,                  A:LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient1)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient1",A)+                    LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient2)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient2",A),                  B:LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient1)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient1",B)+                    LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient2)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient2",B),                  C:LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient1)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient1",C)+                    LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient2)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient2",C)                  }              )`

Set the datatable's Items: test

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 REPLY 1
Community Support

Hi @Manorexia ,

1)I suggest you create 2 tables(Recipes and Base Ingredients)

table1: Base Ingredients( what is "Ingredient1","Ingredient2",... made up of)

The structure of the table is：

IngredientID(text)          A (floating point number)           B          C

Ingredient1                    0.75                                           0.25

Ingredient2                                                                       0.1         0.9

table2: Recipes( what is recipe "Unique123" made up of)

The structure of the table is：

recipeName     Ingredient1        Ingredient2

Unique123         0.5                      0.5

2)insert a drop down, a button, a datatable.

Set the drop down's Items: Recipes      Value:recipeName

Set the button's OnSelect:

`ClearCollect(test,{recipe:Dropdown2.Selected.recipeName,                  A:LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient1)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient1",A)+                    LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient2)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient2",A),                  B:LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient1)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient1",B)+                    LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient2)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient2",B),                  C:LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient1)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient1",C)+                    LookUp(Recipes,recipeName=Dropdown2.Selected.recipeName,Ingredient2)*                    LookUp('Base Ingredients',crb4c_ingredientid="Ingredient2",C)                  }              )`

Set the datatable's Items: test

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements

Manage your user group events

Check out the News & Announcements to learn more.

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors
Users online (1,918)