Forum Discussion
Prior YTD
Hi,
I want to create Prior YTD calculation so I made two versions of it. Not sure which one to go forward with because both are giving different answers ...
These are my two Prior YTD calculation both giving different answer
2 Replies
- v-yanjiang-msftCommunity Support
Hi Anonymous ,
According to your description, I create a sample, and it get the incorrect result as yours.
Here's my solution, modify the Prior YTD formula to :
Previous Year YTD = CALCULATE ( 'Table'[Current YTD], SAMEPERIODLASTYEAR ( 'Table'[Date] ) )Here, directly reference to measure [Current YTD], not Net Sales.
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi,
Thanks for the reply, I have few more confusions.
1. so my date table has a YTD flag , so if I switch on the flag the calculation looks different. but the total value of both way of calculating is the same.
2. In the similar way my YOY growth and variance should also have a different calculation ?
YOY Netsales Growth% =VAR PYsales =calculate([Total Netsales],DATEADD('CDD Fiscal Dates'[date],-1,year))RETURNDIVIDE(([Total Netsales]-PYsales),PYsales) orTotal YoY% =IF(ISFILTERED('CDD Fiscal Dates'[date]),ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),VAR __PREV_YEAR =CALCULATE([current YTD],DATEADD('CDD Fiscal Dates'[date].[Date], -1, YEAR))RETURNDIVIDE([current YTD] - __PREV_YEAR, __PREV_YEAR) again both of these are giving different answers