web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If statement based on ...
Power Apps
Unanswered

If statement based on a Choice field

(0) ShareShare
ReportReport
Posted on by 144

Hi,

 

Im trying to create an If Statement so that if the choice field is a Sell, I Sum the amount and if its a Buy I add Subtract the amount by multiplying it by -1.

 

My error is saying incompatible types for comparison. But it will not work if I set it to .Value either posted below

 

cnr_1-1632744457965.png

 

cnr_3-1632744846748.png

 

 

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    'Transaction Type'.Value = "Sell"

     

    Try that

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

  • cnr Profile Picture
    144 on at

    Hi  @Nogueira1306 

     

    Thanks for responding, I tried that along with the below but neither work.

     

    I get the following errors:

     

    cnr_2-1632745617137.png

    cnr_3-1632745673188.png

     

     

    Unfortunately that doesnt work

    cnr_0-1632745483941.png

     

    cnr_1-1632745579238.png

     

     

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    In the last one I am sure it should be only "Sell"

     

    Do you have that on a gallery or soemthing?

    Try:

     

    ThisItem.'Transaction Type'. Value = "Sell"

     

    We just need to identify which item we want to compare. 

    If you need to comapre all, use a ForAll()

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

     

  • timl Profile Picture
    36,785 Super User 2026 Season 1 on at

    Hi @cnr 

    This is most likely a disambiguation issue that relates to referencing 'Transaction Type'  inside a call a call to AddColumns,

    I'd try the following syntax to see if that works...

     

    If(
     'Transaction Type' = [@'Transaction Type'].Sell

     

     

  • cnr Profile Picture
    144 on at

    Hi @timl 

     

    Thanks for the response,

     

    I'm very confused by this because I used a similar method on a different screen shown here which did work:

     

    cnr_2-1632755294685.png

     

     

    I tried that but didnt work, what do you mean by a call a call to AddColumns?

     

    cnr_0-1632755158042.png

    cnr_1-1632755181263.png

     

  • cnr Profile Picture
    144 on at

    @Hi @Nogueira1306 ,

     

    Yeah I tried that - Says it cannot compare a table and text

    cnr_5-1632755673603.png

     

    I dont understand because I created a similar if statement with the same kind of logic on a choice field and it did work:

    cnr_6-1632755798204.png

     

     

    I created a Clearcollect in a button where I sum up all my values and then ThisItem.NetAmount.

     

    But I need the Amounts to Sum positively if its a Sell and negatively if its a Buy

  • timl Profile Picture
    36,785 Super User 2026 Season 1 on at

    Hi @cnr 

    Can you confirm that 'Transaction Type' is a single select 'Choice' column, rather than a multi select 'Choices' column, as this could account for the incompatible type error?

  • cnr Profile Picture
    144 on at

    Hi @timl 

     

    Yes its a single select 'Choice' column

     

    Thanks

    Conor

  • timl Profile Picture
    36,785 Super User 2026 Season 1 on at

    @cnr 

    To diagnose this further, I would try renaming the Transaction Type field to something like TransType, to remove any ambiguity in naming. If you try the formula below, does that result in the same error?

    AddColumns(
     RenameColumns(UpcomingSettlementFundsGroupingFunds,
     "Transaction Type",
     "TransType"),
     "Netting TPlusOne",
     If(
     TransType = [@'Transaction Type'].Sell

     

  • daruom Profile Picture
    71 on at

    Hello,

    I imagine that "UpcomingSettlementsFundsGroupingFunds" is a colletion (or SP list or whatever)?

    if so, you have to browse the source in a loop before doing your condition.

     

     

    ForAll(
     UpcomingSettlementsFundsGroupingFunds;
     If(
     Choices(ThisRecord.'Transaction Type').value = "sell"
     .....

     

     

    Edit: Replace the ";" by ","

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard