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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Creating a rollup field on Accounts for year-to-date sales based on orders

(1) ShareShare
ReportReport
Posted on by 54
Hi! I was looking into adding some more stats to our accounts in Microsoft Dynamics and I'm trying to figure out to create a field that gets all of the account's orders from this year and sums their amounts. I was able to easily add a "Total Sales" field that just sums all fulfilled orders without a date filter, but it seems like I can't create a rollup field with dynamic dates. Does anyone have any insights into this or know if there's a way to achieve a YTD Sales field? Thanks!
I have the same question (0)
  • Vahid Ghafarpour Profile Picture
    12,228 Super User 2026 Season 1 on at
    I'd create a workflow or plugin that will calculate the YTD sales amount.
    This will involve summing all orders from the beginning of the current year to the current date.
     
  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Moderator on at
    You're correct that Dynamics 365 rollup fields don’t support dynamic filters like “Year-to-Date” (YTD) directly, as rollups only allow static criteria. However, there are some effective workarounds to achieve this:
     
    1. Using Power Automate for Scheduled Updates
     
    You can set up a Power Automate flow to calculate YTD sales and update a custom field on the Account record.
     
    Create a flow that runs on a schedule (e.g., daily or weekly) to:
     
    Retrieve all fulfilled orders related to the account.
     
    Filter the orders by the current year.
     
    Sum the amount fields from these orders.
     
    Update the “YTD Sales” field on the Account with the calculated total.
     
    Advantages:
     
    Dynamic filtering based on dates is possible.
    Reduces the need for complex plugin code.
     
    2. Custom Plugin for Real-Time Updates
     
    If real-time updates are important, a custom plugin can calculate the YTD sales each time an order is created, updated, or fulfilled.
     
    The plugin can fetch the orders for the account, filter them based on the current year, sum the amount, and update the YTD field.
     
     
    Advantages:
     
    Immediate updates for YTD values.
    Flexibility in calculations based on current date and status.
     
    3. Alternative: JavaScript on Form (for Display-Only)
     
    You can also use JavaScript on the Account form to calculate and display YTD sales dynamically when the form is loaded. And update it using web api.
     
    Only limitation is that it won't work during import operation.

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

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 192 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans