cancel
Showing results for
Search instead for
Did you mean:
Highlighted
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: https://www.youtube.com/watch?v=RVcJ3O_O2Jg

This post : https://community.powerbi.com/t5/Desktop/cumulative-target-line/td-p/730076 - 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 : https://community.powerbi.com/t5/Desktop/Day-number-of-year/td-p/55688 )

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 🙂

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

Example

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
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/Appreciate 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!
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

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)

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 :

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

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  :

 Date TargetRevenue TargetRevenue 50% 04/01/2019 0 0 31/03/2020 [finaltarget] [halftarget]

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.

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

Announcements

#### Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

#### Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

#### Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors