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
rajanimaddala
Helper II
Helper II

SAMEPERIODLASTYEAR error

Hi

I have sales table, product table and calendar table

 

I have slicers for FY, Month and Product

I need to get last year sales value for the current month selected. This is my DAX expression

Booked Sales(SET) Last Year = CALCULATE(SUM('BI vwSETSales'[Actual Revenue]), FILTER(ALL('BI vwSETSales'), 'BI vwSETSales'[Source] = "WON_OPPS" && 'BI vwSETSales'[Product Group] IN VALUES('BI vwProductGroup'[Target Group])), SAMEPERIODLASTYEAR('BI vwSETSales'[Transaction Date]))
 
I am gettint error as "SAMEPERIODLASTYEAR expects a contiguous selection when the date column has gaps, not unique..."
I have checked my calendar table. There are no duplicates, no gaps(dates starting from 2015-01-01.
I don't understand this error
Any sugesstion?
Regards
1 ACCEPTED SOLUTION

Hi

Thanks for the reply. I am getting the same error "DATEADD can be used only when contiguous dates exist..."

 

I have used PARALLELPERIOD(BI vwSETSales[Transaction Date], -12, MONTH) and it worked

 

View solution in original post

5 REPLIES 5
v-yuta-msft
Community Support
Community Support

@rajanimaddala ,

 

How about change your measure using dax below?

Booked Sales(SET) Last Year =
CALCULATE (
    SUM ( 'BI vwSETSales'[Actual Revenue] ),
    FILTER (
        ALL ( 'BI vwSETSales' ),
        'BI vwSETSales'[Source] = "WON_OPPS"
            && 'BI vwSETSales'[Product Group] IN VALUES ( 'BI vwProductGroup'[Target Group] )
    ),
    DATEADD ( 'BI vwSETSales'[Transaction Date], -1, YEAR )
)

Community Support Team _ Jimmy Tao

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

Hi

Thanks for the reply. I am getting the same error "DATEADD can be used only when contiguous dates exist..."

 

I have used PARALLELPERIOD(BI vwSETSales[Transaction Date], -12, MONTH) and it worked

 

Thank you very much, I've been trying for a long time to solve this error problem and with your solution of using 'PARALLELPERIOD' it was solved.

mussaenda
Super User
Super User

Change your transaction date to your date from calendar  table

Hi,

 

Thanks for the reply. I have tried but it is calculating SUM(vwSETSales[Actual Revenue]) from entire resutset

No filters applied.

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