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 Automate / compare year of date w...
Power Automate
Answered

compare year of date with string

(0) ShareShare
ReportReport
Posted on by

In Dynamics 365 I have a "financial target" entity. It allows me to create a target for income against a person for a set year. i.e. against John Smith, create an income target of £10,000 for FY2020 and £12,000 for FY2021 (Financial years match calendar years). The fields are contact (lookup), financial year (option set), target (currency) and current total (currency).

 

I am then using a flow to populate the current total by looking for all income records associated with the same contact and dated in the relevant financial year. 

 

To do this I am looking for all financial target records. Then, in an apply to all stage I am looking for all income records where the donor is the contact from the financial target record and where the income date has the same year as the financial year from the target. That is where I am having an issue. The financial year is expressed as "FY2020" and income date is a completed datetime field. I seem to be struggling with it. I know I need to use an expression but I struggle with using an expression in an odata filter. I need to match on the contact from the current item (i.e. the financial target record we are looking at) AND on all income records where the year of the income date matches the year from FY2020. This would then allow me to create another apply to all step where I can then go through all these income records to Sum them before moving onto the next financial target record and repeating.

 

Is this the best approach to do this? How can I list records comparing the year from a datetime to a string?

Categories:
I have the same question (0)
  • Verified answer
    v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @jsteele303,

     

    You could use the Filter array and FormatDateTime() function to filter out the date which year equals to FY, I create an entity to explain it.

    You could input the array into the Filter array action, on the left side is the string "FY2020", we need use replace() function to remove FY; on the right side is FormatDateTime() function to convert the Date string into "yyyy":

    屏幕截图 2020-09-18 181853.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 67

#2
David_MA Profile Picture

David_MA 64 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 39 Most Valuable Professional

Last 30 days Overall leaderboard