Forum Discussion
Issues generating a YTD from previous year
- 4 years ago
Hi jnpb ,
I think it should be because your date contains timestamp. You need to create a new Date column, like this.
Then change the measure to
Measure = CALCULATE ( SUM ( 'Table'[NPSRecommend] ), SAMEPERIODLASTYEAR ( DATESYTD ( 'Table'[Date] ) ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You need to use TotalYTD to get the results and combine it with PreviousYear
Have a look at this blog
https://www.sqlbi.com/blog/marco/2018/08/10/the-hidden-secrets-of-totalytd/
Nishant
- jnpb4 years agoHelper I
Hi Nishant,
I tried to figure this out but my attempt doesn't work (I'm very unfamiliar with the subject matter). This is what I tried - can you help identify what I did wrong and how to correct it?Measure = TOTALYTD(PREVIOUSYEAR(Query1[NPSRecommend]),Query1[Submission Date])- v-kkf-msft4 years agoCommunity Support
Hi jnpb ,
Please try the measure.
Measure = CALCULATE ( SUM ( 'Table'[NPSRecommend] ), SAMEPERIODLASTYEAR ( DATESYTD ( 'Table'[Submission Date] ) ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- jnpb4 years agoHelper I
Hi Winniz,
I tried this measure and got the following error:
The data in the submission date table are date/timestamps that are sometimes the same - i have to be able to work with duplicate dates: is there an alternative to datesytd that would work here?