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 / Need Help on IF Condit...
Power Apps
Answered

Need Help on IF Conditions

(0) ShareShare
ReportReport
Posted on by 14

Hello All,

 

I am building a calorie counter app and I am kinda stuck with the If statement. What I am trying to achieve is to calculate the calorie intake according to user preference. 

 

Here is my IF statement.

 

If(
(GenderCal.Selected.Value = "male" & ActivityLevelCal.SelectedText.Value = "Not Very Active"),
(1.2 * (10 * WeightCal) + (6.25 * HeightCal) - (5*AgeCal) + 5), UpdateContext({DailyCalCount: true})
);

If(
GenderCal.Selected.Value = "male" & ActivityLevelCal.SelectedText.Value = "Active",
(1.55 * (10 * WeightCal) + (6.25 * HeightCal) - (5*AgeCal) + 5), UpdateContext({DailyCalCount: true})
);
If(
GenderCal.Selected.Value = "male" & ActivityLevelCal.SelectedText.Value = "Very Active",
(1.9 * (10 * WeightCal) + (6.25 * HeightCal) - (5*AgeCal) + 5), UpdateContext({DailyCalCount: true})
);

 

I am getting this error: 

Incompatible type. We can't evaluate your formula because the values being compared in the formula aren’t the same type.

The left value is a Boolean type and the right value is a Text type.

 

I've attached a screenshot for  the reference

 

Could someone please help me with this regard?

 

Thank you,

Shay

 

Screen Shot 2020-11-11 at 2.35.36 AM.png

Categories:
  • Verified answer
    timl Profile Picture
    37,306 Super User 2026 Season 2 on at

    Hi @Shayarana16 

    It's possibly related to this line of code:

    GenderCal.Selected.Value = "male"

    Here, the the left value could be Boolean and the right value Text.

    To clarify if this is case, could you enter the following into a label and confirm what you see? Do you see "male/female", or do you see a true/false value?

    GenderCal.Selected.Value

  • Shayarana16 Profile Picture
    14 on at

    Hi @timl 

     

    Thanks for the response. 

     

    i've changed the code like this,

     

    If(
    GenderCal.Selected.Value = "male" And ActivityLevelCal.SelectedText.Value = "Not Very Active",
    true,
    true,
    Sum(1.2 * (10 * WeightCal) + (6.25 * HeightCal) - (5*AgeCal) + 5),
    UpdateContext({DailyCalCount: true})
    );

     

    is this what you suggested to me?

     

    thank you,

    Shay

  • Verified answer
    Shayarana16 Profile Picture
    14 on at

    I got it resolved. Thanks for the help @timl

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard