Calculate the SUM, COUNT, AVERAGE, MAX, MIN

Input collection: myTravelExpenses11

DateItemValue
1/1/2020Hotel1050
1/1/2020Food30
1/2/2020Food75
1/3/2020Hotel1300
1/3/2020Food50
1/4/2020Flight800


Output value: SUM of Value

3305


Solution code:

//Create a collection
ClearCollect(myTravelExpenses11,
{Date: Date(2020,1,1), Item: "Hotel", Value: 1050},
{Date: Date(2020,1,1), Item: "Food", Value: 30 },
{Date: Date(2020,1,2), Item: "Food", Value: 75 },
{Date: Date(2020,1,3), Item: "Hotel",Value: 1300},
{Date: Date(2020,1,3), Item: "Food", Value: 50},
{Date: Date(2020,1,4), Item: "Flight", Value: 800}
);

//Get the sum code
Sum(myTravelExpenses11,Value)


Output value: COUNT of Value

6


Solution code:

//Get the count code
CountRows(myTravelExpenses11)


Output value: AVERAGE of Value

550.8333


Solution code:

//Get the average code
Average(myTravelExpenses11,Value)


Output value: MAX of Value

1300


Solution code:

//Get the maximum code
Max(myTravelExpenses11,Value)


Output value: MIN of Value

30


Solution code:

//Get the minimum code
Min(myTravelExpenses11,Value)