cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Need help with Distinct and to add numbers from a If statement

I have a Sharepoint list I want to do a formula with

 

The formula goes like this If(Source.Column1 have the same string or if there is only one of the same string, Add the numbers of Source.Column2 that are the same together)

 

I also want to Collect(Distinct(Source, Column1 with the results from the If statement).

 

Hope it makes sense.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Need help with Distinct and to add numbers from a If statement

I believe something like this will accomplish what you are trying to do.

ClearCollect(colResults,                                 //* create a new collection called colResults
DropColumns(
AddColumns(
GroupBy(Source, "Column1", "by_Column1"), //* group by the unique values in Column1
"total_Column2",Sum(by_Column1, Column2)), //* total the records for those unique values
"by_Column1")) //* drop the extra columns you don't need

With the source data on the left, this statement produces the output on the right. 

 

1a.png

 

Hope this helps.

View solution in original post

1 REPLY 1
Highlighted
Super User
Super User

Re: Need help with Distinct and to add numbers from a If statement

I believe something like this will accomplish what you are trying to do.

ClearCollect(colResults,                                 //* create a new collection called colResults
DropColumns(
AddColumns(
GroupBy(Source, "Column1", "by_Column1"), //* group by the unique values in Column1
"total_Column2",Sum(by_Column1, Column2)), //* total the records for those unique values
"by_Column1")) //* drop the extra columns you don't need

With the source data on the left, this statement produces the output on the right. 

 

1a.png

 

Hope this helps.

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,401)