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

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
    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

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard