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 / Add calculated field i...
Power Apps
Answered

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,747 Moderator 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,747 Moderator 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,747 Moderator 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

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 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard