cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ByPA
Helper I
Helper I

Multiply the values in a column

Hi,

 

I have collated multiple tables into one overall table which is named OverallTable.

 

The OverallTable has multiple fields:

ByPA_0-1633916699050.png

 

The Overall Table has about 40 records.

 

I am trying to get a multiplication of all the rows in RF i.e. 1 x 1 x 1.1822 x 1.100 x 0.7 x 1 x 0.4...

 

but I understand that PowerApps has no such function.

 

I am trying to follow the suggestion below:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Calculate-Product-Multiply-all-numbers-in-a-...

 

and ended up with

 

 

 

 

 

ClearCollect(NumColTest,{total:1});
ForAll(OverallTable,Patch(NumColTest,First(NumColTest),{total:First(NumColTest).total*CountRows(OverallTable)}));

 

 

 

 

 

However, I want to have the product of the column RF, so so I tweak it:

 

 

 

 

ForAll(OverallTable.RF,Patch(NumColTest,First(NumColTest),{total:First(NumColTest).total*CountRows(OverallTable)}));

 

 

 

 

 

A first look at NumColTest doesn't seem right, assuming it is the product of the RFs.

 

Below is when I force the number of records to be 2:

 

ForAll(OverallTable.RF,Patch(NumColTest,First(NumColTest),{total:First(NumColTest).total*2}));

 

 

ByPA_0-1633915078156.png

 

 

Wondering if anybody has any ideas? Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Super User
Super User

Hi @ByPA 

 

Updated the above post as per your data.

 

View solution in original post

3 REPLIES 3
StalinPonnusamy
Super User
Super User

Hi @ByPA 

 

 

ClearCollect(OverallTable, {RF:1,RS:"1000000"},{RF:1,RS:"Administrative"},{RF:1.18,RS:"1000000"},{RF:1.10},{RF:0.7,RS:"1250"});
ClearCollect(NumColTest,{total:1});
ForAll(OverallTable,Patch(NumColTest,First(NumColTest),{total:First(NumColTest).total*RF})) 

 

 

Set Lable Text Property to

 

First(NumColTest).total

 

 

Example (1 * 1.18 * 1.10 * 0.7) = 0.9086 (As per my sample data)

 

StalinPonnusamy_1-1633922895858.png

 

 

StalinPonnusamy
Super User
Super User

Hi @ByPA 

 

Updated the above post as per your data.

 

It is definitely looking more reasonable now! Thanks so much!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,439)