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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add calculated field i...
Power Apps
Unanswered

Add calculated field in Power App

(0) ShareShare
ReportReport
Posted on by 76

I have a Sharepoint List data source for a Power App. The list is of contractors.  Two of the fields in the list are Start Date and End Date.  In the Power App, I would like to add a calculated field to determine the Status by comparing the Start Date and End Date to Today, e.g.

 

=IF([Start Date] > TODAY, "Inactive",
IF(AND([Start Date] < TODAY, [End Date] > TODAY), "Active",
IF(AND([Start Date] < TODAY, [End Date] < TODAY), "Inactive",
IF(ISBLANK([Start Date]), "Inactive",
"Active"))))

 

But I haven't been able to determine where to add the calculated field in Power Apps.  Can anyone advise?  Thanks!

Categories:
I have the same question (0)
  • Verified answer
    Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Hi @StaceyGriffeth 

     

    In the Gallery where you're displaying the contractor data, add a Label or Text Input control. This will act as your calculated field to show the status.

     

    Set the Text property of this Label or Text Input control to perform the calculation based on the Start Date and End Date fields from your SharePoint list.

     

    Text(
    If(
    IsBlank(ThisItem.'Start Date'),
    "Inactive",
    If(
    ThisItem.'Start Date' > Today(),
    "Inactive",
    If(
    And(
    ThisItem.'Start Date' < Today(),
    ThisItem.'End Date' > Today()
    ),
    "Active",
    If(
    ThisItem.'End Date' < Today(),
    "Inactive",
    "Active"
    )))
    ))

     

    (Or)

     

    If(
    ThisItem.'Start Date' > Today(), "Inactive",
    ThisItem.'Start Date' < Today() && ThisItem.'End Date' > Today(), "Active",
    ThisItem.'Start Date' < Today() && ThisItem.'End Date' < Today(), "Inactive",
    IsBlank(ThisItem.'Start Date'), "Inactive",
    "Active"
    )

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • StaceyGriffeth Profile Picture
    76 on at

    Thanks for the quick reply, @Rajkumar_404 !  This would be displayed in a data table, and it would calculate for each row in the table.  How do I add a text label or input for each row in the table?  I apologize if this is elementary, I'm very new to Power Apps.

  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    This is for only display calculate data in PowerApps. If you want to store displayed data to SharePoint, use the Patch function. To display SharePoint data, use Gallery.

  • StaceyGriffeth Profile Picture
    76 on at

    Hi @Rajkumar_404  I converted this to be a gallery, added all of my fields, and created the calculated field 'Status'.  It is calculating correctly except where Start Date is blank.  Those items are returning a value of "Active".  Start Date is a 'Date and Time' field in the Sharepoint list.  The formula for the Status calculation is:

     

    If(
    ThisItem.'Start Date' < Today() && ThisItem.'End Date' > Today(), "Active",
    ThisItem.'Start Date' < Today() && IsBlank(ThisItem.'End Date'), "Active",
    ThisItem.'Start Date' < Today() && ThisItem.'End Date' < Today() && Not(IsBlank(ThisItem.'End Date')), "Inactive",
    ThisItem.'Start Date' > Today(), "Inactive",
    IsBlank(ThisItem.'Start Date'), "Inactive",
    "Active"
    )

     

    Do you have any idea why that would not be calculating correctly?

  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Hi @StaceyGriffeth 

     

    You can modify the formula to check if the 'Start Date' is blank before evaluating its value.

     

    If(
    IsBlank(ThisItem.'Start Date'), "Inactive",
    ThisItem.'Start Date' < Today() && ThisItem.'End Date' > Today(), "Active",
    ThisItem.'Start Date' < Today() && IsBlank(ThisItem.'End Date'), "Active",
    ThisItem.'Start Date' < Today() && ThisItem.'End Date' < Today() && Not(IsBlank(ThisItem.'End Date')), "Inactive",
    ThisItem.'Start Date' > Today(), "Inactive",
    "Active"
    )

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • StaceyGriffeth Profile Picture
    76 on at

    @Rajkumar_404 that fixed it!  Thanks so much for all your help!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard