Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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.

 

ramp.PNG

 

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
amitchandak
Super User
Super User

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

Anonymous
Not applicable

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 🙂

Anonymous
Not applicable

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

 

DateTargetRevenueTargetRevenue 50%
04/01/201900
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.

 

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

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.