cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Manorexia
Level: Powered On

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 Team
Community Support Team

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

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: test619.png

 

 

 

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.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

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

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: test619.png

 

 

 

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.

View solution in original post

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,730)