Forum Discussion
Issue with SAMEPERIODLASTYEAR and Manual Time Intelligence
Hi,
the visual on the right works as expected, as it uses built-in time intelligence and automatic date handling.
However, I would like to use the visual on the left without automatic time intelligence.
In this case, the posting date 02.05.2025 is mapped incorrectly โ it should be assigned to WD 1, but currently isnโt.
How can I achieve the correct mapping while staying without automatic time intelligence?
Measure for the right one:
Current measure for the left one:
My calendar table is already configured with WD_Running_Total = 1 for 02.05.2025.
Thanks a lot for your support!
Best regards
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.
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.
23 Replies
- johnt75Super User
Try marking the Date table as a date table, then the SAMEPERIODLASTYEAR should work I think.
- fcb2026Frequent Visitor
already done, but it doesn't work with the like for like comparison ๐
02.05.2025 is a friday, 04.05.2025 is a sunday. Both sales should be mapped to WD 1 in prior year = 2025
- Natarajan_MSuper User
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 notebookFor more Power BI tips and discussions, let's connect on LinkedIn.
Cheers!
- fcb2026Frequent Visitor
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?
- johnt75Super User
You can share it from GoogleDrive, OneDrive or similar, or use a sharing service like dropbox.
- fcb2026Frequent Visitor
- Ashish_MathurSuper User
Hi,
That link does not have the file