cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

How to display Last Year sales but not accumulated?

Hello, I am trying to do a report based on YTD sales from previous years, compared to this year.

 

If I use this formula

 

YTD de MONTO_USD = TOTALYTD(SUM('APPEND_VEPEDDET'[MONTO_USD]),SAMEPERIODLASTYEAR('CALENDARIO'[Date]))

 

I can actually see the last year sales, but when I apply this value into a line chart visual to compare last year sales (blue line) with the current year sales (light blue line), I can see that previous year sales are accumulated each month, which distorts the comparison since I need to display total sales for each month individually, not accumulated (this year's sales are displayed correctly)

 

jmr78_1-1597321884050.png

 

Is it possible to do this? I have been trying for a few days already, but I coul not find a workaround.

 

Thank you!!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IX
Super User IX

Re: How to display Last Year sales but not accumulated?

@jmr78 , You need use ytd measure in SAMEPERIODLASTYEAR. Make sure calendar table is marked as date table

 

You can use measures like

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/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))
//Only year vs Year, not a level below

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

3 REPLIES 3
Highlighted
Super User IX
Super User IX

Re: How to display Last Year sales but not accumulated?

@jmr78 , You need use ytd measure in SAMEPERIODLASTYEAR. Make sure calendar table is marked as date table

 

You can use measures like

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/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))
//Only year vs Year, not a level below

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Community Support
Community Support

Re: How to display Last Year sales but not accumulated?

Hi @jmr78 ,

 

Try to change your measure like so:

YTD de MONTO_USD =
CALCULATE (
    SUM ( 'APPEND_VEPEDDET'[MONTO_USD] ),
    SAMEPERIODLASTYEAR ( 'CALENDARIO'[Date] )
)

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Regular Visitor

Re: How to display Last Year sales but not accumulated?

That worked great! Thank you very much @amitchandak😀

 

One more question: the last year's YTD shows the amount for the whole month. For example, when I see sales from August 2019, the value represents the sales from the 1st to the 31st of given month. Is there any way to show the sales up to today's date one year ago (Aug 14th), so I compare sales from 01-14 AUG 2020 to 01-14 AUG 2019?

 

Thank you!

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors