Forum Discussion
Issue with SAMEPERIODLASTYEAR and Manual Time Intelligence
- 3 months ago
Hi fcb2026,
Thank you Ashish_Mathur Natarajan_M johnt75, for your insights.
I was able to reproduce the issue in the PBIX file you provided.
The problem occurs because the current PY measure relies on DATEADD() or SAMEPERIODLASTYEAR(), which compare exact calendar dates rather than using the custom WD_Running_Total (working-day sequence) logic.
Thank you.
- 3 months ago
You need to separate the working days from the date dimension. Create a new table like
Working Day = SELECTCOLUMNS( GENERATESERIES( 1, 23 ), "Working Day", [Value] )Create a one-to-many relationship from this new table to your Date table. Use the column from this table in your visuals, and change your PY measure to
PY = VAR _CurrentYear = CALCULATE( MAX( 'DATE'[Year] ), REMOVEFILTERS( 'Working Day' ) ) VAR _CurrentMonth = CALCULATE( MAX( 'DATE'[Period] ), REMOVEFILTERS( 'Working Day' ) ) VAR _CurrentWD = VALUES( 'Working Day'[Working Day] ) RETURN CALCULATE( SUM( SALES_TABLE[Sales] ), REMOVEFILTERS( 'DATE' ), _CurrentWD, 'DATE'[Year] = _CurrentYear - 1, 'DATE'[Period] = _CurrentMonth )See attached PBIX for sample.
Hi fcb2026 ,The first change you can make is to mark the date table as a calendar table and set the appropriate grain. Ensure that the dates are continuous. If this does not resolve the issue, please share the PBIX file so we can provide better assistance.
Thanks!
Natarajan Manivasagan
If you found this helpful, please consider giving it a Kudos and marking it as the accepted solution โ it goes a long way in helping others facing the same issue.
๐ Best Solution for Enterprise BI โ 2026 Microsoft Fabric Semantic Link Developer Experience Challenge
๐ Microsoft announcement ยท View the winning notebook
For more Power BI tips and discussions, let's connect on LinkedIn.
Cheers!
Unfortunately, I don't have an option upload the pbix file in the forum. Is it restricted for new members? how can i share my test file with you?