Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Compare cumulative result (YTD) against Cumulative target with custom fiscal year

Hello !


I'm connecting PowerBI and Salesforce

I would like to build a graph showing the cumulated sales result progress against a cumulated running target which end on the salesperson's quota.

  • In the below graph, the cumulated result progress would be the black line.
  • The final sales quota would be the top of the red area.
  • The graph allows to compare the distance from the actual result to the targe result over time.




To create the cumulative sum / running total of results, I've been using:


This post : - suggests to create a "day of year" measure or calculated column.


However, my fiscal year starts on April 1st, and the the day of year "classic" formula based on DATEDIFF provides negative values for days from January 1st to march 31st :


DayNoOfYear =
DATEDIFF ( DATE ( YEAR ( 'Table'[Date] ), 4, 1 ), 'Table'[Date], DAY ) + 1

( found also here : )


March 31st => -1 (when it should be 365)

March 29th => -2 (when it should be 364)

March 28th => -3 ...


Would you have any idea on how to solve this ?

Many thanks in advance 🙂

Super User IV
Super User IV

Re: Compare cumulative result (YTD) against Cumulative target with custom fiscal year

Create a calendar table and mark it as date and use datesytd, totalytd


YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"3/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"3/31"))
Last complete YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"3/31"))

Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
2 Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Cumm Sales overall = CALCULATE(SUM(Sales[Sales Amount]),filter(sales,sales[date] <=maxx(date,date[date])))


To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
In case it does not help, please provide additional information and mark me with @
My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP,
HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Super User! Linkedin

Frequent Visitor

Re: Compare cumulative result (YTD) against Cumulative target with custom fiscal year

Hello @amitchandak ,
thank you for your help in here :)I've been following your links and advices, but I'm not going forward yet.


This is the basic view I'm trying to obtain  :

YTD sales against a target sales quota (black line) for each month of the fiscal year


Goal 1.jpg


Ideally I would add more information such as last year's YTD and expected revenue for the end of the year (displaying future opportunities which are neither won or lost)


Goal 2.jpg


I followed you links and advices to restart from scratch and create a new data table and two first measures, here is what I have right now :


001 Current Graph.jpg


I'm displaying :
Filters :

  • Alias = One salesperson's alias
  • CloseDate between 04/01/2019 and 03/31/2020
  • StageName = Won


In X axis : CloseDate of the Opportunities

Values :

  • YTD Sales Old = Measure on the Opportunity table :
    CALCULATE (SUM(Opportunity[Amount]); FILTER( ALLSELECTED(Opportunity); Opportunity[CloseDate] <= MAX(Opportunity[CloseDate])) )
  • YTD Amount (Displays nothing ?) = Measure on the Opportunity table : CALCULATE(SUM(Opportunity[Amount]);DATESYTD(DateDim[Date];"31/03"))
  • Last YTD Sales (Displays nothing ?) = Measure on the Opportunity table : CALCULATE(SUM(Opportunity[Amount]);DATESYTD(dateadd(DateDim[Date];-1;year);"31/3"))
NB : using the French locale so "31/3" instead of "3/31" and ";" instead of ","


My original data tables look like this (without measures) :

Table structure (simple).jpg


Each sales user manage several Opportunities.

Each Opportunity has a name, an amount, a CloseDate (expected or definitive) and a StageName ( Prospecting > Proposal > Negotiation > Won > Lost )


Any idea why your YTD Amount and Last YTD Sales doesn't work for me?

Any idea on how I could add a black line to represent my YTD target ?

Many thanks for your time 🙂

Frequent Visitor

Re: Compare cumulative result (YTD) against Cumulative target with custom fiscal year

Slowly making progress. It hit me last night, I could just create a table with  :


DateTargetRevenueTargetRevenue 50%


I also understood that I should use the Date dimension created instead of the CloseDate as X axis.
I have yet to understand why it changes the graph.


Making progress.jpg

I can see that your formula calculates a value for each date of the calendar, which results in a staircase graph when sales users only forecast opportunities to the last day of each month.

I don't know if there is a way to avoid that. Maybe by better understanding date hierarchies and how to create them. (If anyone has a suggestion 🙂 )

I also understand that this date hierarchy will be necessary to compare Year on Year values.

Helpful resources

New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors