Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

If column contains value then ignore calculation in power apps

(0) ShareShare
ReportReport
Posted on by 289
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 289 on at
    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.
     
     
     
  • Verified answer
    Prem4253 Profile Picture
    Prem4253 289 on at
    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 at
    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,065 on at
    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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard