Hi,
I have question about YTD Last year DAX formula. Even though I have read many blogs and topics here in community, I still don't know how to solve this issue.
Suppose I have data like below.
ID | Date | Amount |
1 | 01.01.2016 | 10 |
2 | 02.01.2016 | 15 |
3 | 03.01.2016 | 11 |
4 | 10.01.2016 | 8 |
5 | 20.02.2016 | 7 |
6 | 01.01.2017 | 10 |
7 | 02.01.2017 | 12 |
8 | 03.01.2017 | 9 |
I would like to figure up YTD value of amount for actual data (year 2017) and then YTD value for corresponding period previous year.
For YTD I use formula:
YTD = CALCULATE(SUM(Data[Amount]);DATESYTD(Date[Date]))
For YTD LY I use formula:
YTD LY = CALCULATE([YTD];SAMEPERIODLASTYEAR(Date[Date]))
Then when I use these formulas in PBI, I have got incorrect value for YTD LY. I expect value 36 (dates: 1.1. - 3.1. 2016), but in total I have got 44 (it also calculates Amount 8 in 10.1.2016) - so it gives me period of january 2016, but I want only the corresponding days from 2017.
But YTD LY value in pic below on row for 3.1.2017 is OK.
Image may be NSFW.
Clik here to view.
Does anybody know the solution?
Thanks.
Regards.
Pavel