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

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

Reply
omarpiceno92
New Member

Direct Query - DAX function issue (SamePeriodLastYear)

Hi, 

 

I accessing data through Direct Query. While using SamePeriodLastYear function in some measures, I am trying to slice data monthly as well. However, the following error message is displayed in my visualizations while adding a Month slicer:

 

MdxScript(Model) (56, 124) Calculation error in measure 'General Ledger Activities'[GL Amount PY]: Function 'SAMEPERIODLASTYEAR' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion.

 

My DAX formula for GL Amount PY is the following: 

GL Amount PY = CALCULATE('General Ledger Activities'[GL Amount],All('Fiscal Calendars'), SAMEPERIODLASTYEAR('Fiscal Calendars'[Date]))

 

It would be greatly appreciate if someone can help me solve this issue. 

 

Bests,

Omar

 

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @omarpiceno92,

 

I also agree with Ross73312. Have you solved your problem?

 

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please share some data sample which could reproduce your scenario.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Is your fincial calenders a true date table?  Does it have 1 row for each date?

 

If not, i'd suggest creating a full date table.  This can be done fairly simply using either Power Query or DAX.  A quick google search will turn up a few methods you can usually just copy and paste into your project.

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.