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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Niall
Regular Visitor

Running Total using SAMEPERIODLASTYEAR

Hi

 

I have a measure as follows

UniqueInteractionId = DISTINCTCOUNT('Interactions'[Interaction: ID])

I then have two measures to calculate the monthly runnning total for this year and for last year

 

MonthlyTotalThisYr = 
CALCULATE (
    [UniqueInteractionId], 
    DATESYTD( Dates[Date] )
)
MonthlyTotalLastYr = 
CALCULATE (
    [UniqueInteractionId], 
    SAMEPERIODLASTYEAR ( Dates[Date] )
)

The current year works as expected however the prior year does not

 

Capture.PNG

Might anyone have any suggestions as to what i am doing wrong?

 

Thanks

 

 

 

1 ACCEPTED SOLUTION
lc_finance
Solution Sage
Solution Sage

Hi @Niall ,

 

 

The formula SAMEPERIODLASTYEAR takes the same month from the previous year but it does not calculate the YTD. This is why you don't see the correct numbers.

 

You can try the formula below:

 

MonthlyTotalLastYr = 
CALCULATE (
    [UniqueInteractionId], 
    DATEADD(DATESYTD(Dates[Date]),-1,Year)
)

The formula first calculates the YTD, then the function DATEADD subtracts one year from the YTD. Therefore you obtain the YTD of the previous year.

 

Let me know if this fixes your problem.

 

Regards,

 

LC

Interested in Power BI templates? Check out my blog at www.finance-bi.com

View solution in original post

3 REPLIES 3
lc_finance
Solution Sage
Solution Sage

Hi @Niall ,

 

 

The formula SAMEPERIODLASTYEAR takes the same month from the previous year but it does not calculate the YTD. This is why you don't see the correct numbers.

 

You can try the formula below:

 

MonthlyTotalLastYr = 
CALCULATE (
    [UniqueInteractionId], 
    DATEADD(DATESYTD(Dates[Date]),-1,Year)
)

The formula first calculates the YTD, then the function DATEADD subtracts one year from the YTD. Therefore you obtain the YTD of the previous year.

 

Let me know if this fixes your problem.

 

Regards,

 

LC

Interested in Power BI templates? Check out my blog at www.finance-bi.com

Thanks - works perfectly

Good to hear!

 

Best of luck for your analysis

 

LC

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors