Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

If column contains value then ignore calculation in power apps

Like (0) ShareShare
ReportReport
Posted on 14 Jan 2025 09:14:30 by 218
Hello,
 
See below Screenshot:
 
 
Amount 1 and Amount 2 are Number format fields. Below is the formula used to calculate the Variance. If Amount 2 is greater than Amount 1, it will return zero. DataCardValue13 is Amount 1 and DataCardValue5 is Amount 2.
If(Value(DataCardValue5.Text) > Value(DataCardValue13.Text),0,Value(DataCardValue13.Text) - Value(DataCardValue5.Text))
There are additional 5 fields into the form. 
 
I'm looking for a logic - where if Amount 2 (DataCardValue5) is blank, Sum the below 5 fields and save the calculated values to Sharepoint
Sum(
DataCardValue36.Text,
DataCardValue37.Text,
DataCardValue38.Text,
DataCardValue39.Text,
DataCardValue40.Text)
We should also allow users to manually enter the value in Amount 2 and save the same records to SharePoint.
 
If Amount 2 has some value, ignore the Sum Calculation else use the Sum Calculation.
 
Please advise. Thanks!
  • Prem4253 Profile Picture
    Prem4253 218 on 15 Jan 2025 at 07:44:12
    If column contains value then ignore calculation in power apps
     
    Tried to apply this formula on Change property but no luck, as the actual amount still shows blank.
     
     
     
  • Prem4253 Profile Picture
    Prem4253 218 on 14 Jan 2025 at 12:48:58
    If column contains value then ignore calculation in power apps
     
    I have a Submit button, where OnSelect property is set as below: (FormInspection is the name of the form)
    SubmitForm(FormInspection);
    Notify ("Please make sure all fields are filled in correctly ",NotificationType.Error,3000)
    I tried using your formula for OnChange property for DataCardValue5, but Amount 2 still shows blank
     
     
  • RR-12011342-0 Profile Picture
    RR-12011342-0 8 on 14 Jan 2025 at 12:07:46
    If column contains value then ignore calculation in power apps
    Hi,
     
    Try using below code
     
    UpdateContext({
        FinalAmount2: If(
            IsBlank(Value(DataCardValue5.Text)), 
            Sum(
                Value(DataCardValue36.Text),
                Value(DataCardValue37.Text),
                Value(DataCardValue38.Text),
                Value(DataCardValue39.Text),
                Value(DataCardValue40.Text)
            ),
            Value(DataCardValue5.Text)
        )
    });
     
     
    Then PATCH
  • ANB Profile Picture
    ANB 7,036 on 14 Jan 2025 at 11:42:36
    If column contains value then ignore calculation in power apps
     
    Since I dont see the complete information about how you are saving the data to SharePoint, it will be difficulties to give complete logic, however I will try to help with basic logic:
     
    Use this:
    If(
       IsBlank(DataCardValue5.Text), 
       Set(gblvar_Sum,
    Sum(
    DataCardValue36.Text,
    DataCardValue37.Text,
    DataCardValue38.Text,
    DataCardValue39.Text,
    DataCardValue40.Text));
    .....Logic to Save using gblvar_Sum.....,
    .....Logic to Save without using gblvar_Sum.....
    )
    In above code, first we check whether DataCardValue5 is blank or not, if blank then we declare one global variable named as gblvar_Sum which is nothing but the sum of 5 fields and then sequentially we save the data to SP either using Patch or Submit form using global variable required for the field else save the data to SP using manually enter data.
     
    Please share more on save code, so that I can help further.
     

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.


    Thanks,
    ANB

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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,593

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,403

Leaderboard
Loading started