Calculate The SUMPRODUCT Of Two Columns

Input collection: mySales25

ItemUnitsSoldPricePerUnit
Notebook252.5
Crayons158.62
Binders1013.34
Pencils211.5
Erasers300.89


Output value: mySolution25 (SUM of UnitsSold * PricePerUnit)

383.4


Solution code:

//Create a collection
ClearCollect(mySales25,
{Item: "Notebook", UnitsSold: 25, PricePerUnit: 2.5},
{Item: "Crayons", UnitsSold: 15, PricePerUnit: 8.62},
{Item: "Binders", UnitsSold: 10, PricePerUnit: 13.34},
{Item: "Pencils", UnitsSold: 21, PricePerUnit: 1.5},
{Item: "Erasers", UnitsSold: 30, PricePerUnit: 0.89}
);

//Calculate the SumProduct code
Set(mySolution25,Sum(mySales25,UnitsSold * PricePerUnit));