cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WebPortal
Post Prodigy
Post Prodigy

Add conditional column to collection

This is MyCollection:

 

ColumnA   | ColumnB

123            |  500

253            |  550

278            |  650

987            |  400

 

I want to add a new conditional column:

If the first digit of ColumnA is 1, then NewColumn = ColumnB, else -ColumnB

 

So:

AddColumns(MyCollection, NewColumn = ????)

1 ACCEPTED SOLUTION

Accepted Solutions

You can also try:

    AddColumns(
        MyCollection,
        "NewColumn",
        If(
            Value(
                Left(
                    Text(ColumnA),
                    1
                )
            ) = 1,
            ColumnA,
            ColmumnB
        )
    

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

2 REPLIES 2
Amol-Kavnekar
Helper I
Helper I

Hi @WebPortal ,

 

You can use If condition in this case 

 

If(StartsWith("Your Data Source column",1),AddColumns(MyCollection, NewColumn = ColumnB) , "Else your other condition")

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Amol 

You can also try:

    AddColumns(
        MyCollection,
        "NewColumn",
        If(
            Value(
                Left(
                    Text(ColumnA),
                    1
                )
            ) = 1,
            ColumnA,
            ColmumnB
        )
    

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (67,893)