Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

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 ...

 

Prior YTD = calculate (
[Total Netsales],SAMEPERIODLASTYEAR('CDD Fiscal Dates'[date]))
 
 and another formula 
 
prior_YTD_2 = CALCULATE([Total Netsales],PREVIOUSYEAR(DATESYTD('CDD Fiscal Dates'[date])))
 
both are giving me different Prior YTD. Could anyone help me with this confusion please. 
 
MaliniB_1-1655923032890.png

 

These are my two Prior YTD calculation both giving different answer 


 

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample, and it get the incorrect result as yours. 

vkalyjmsft_0-1656401198651.png

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.

vkalyjmsft_1-1656401430412.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

Anonymous
Not 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))
RETURN
DIVIDE(([Total Netsales]-PYsales),PYsales)      or 
 
Total 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)
        )
    RETURN
        DIVIDE([current YTD] - __PREV_YEAR, __PREV_YEAR)  again both of these are giving different answers 
 
MaliniB_0-1656430392553.png

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.