Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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)
Is it possible to do this? I have been trying for a few days already, but I coul not find a workaround.
Thank you!!
Solved! Go to Solution.
@Anonymous , 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
Hi @Anonymous ,
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.
@Anonymous , 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
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!
User | Count |
---|---|
127 | |
108 | |
99 | |
63 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |