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, please have a look at message below (7 of 9)
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.
- fcb20263 months agoFrequent Visitor
Thank you very much for your support!
Appreciate it, but even with your solution, there is still a bug when i add further data with different working days (in total) per month
- v-saisrao-msft3 months agoCommunity Support
Hi fcb2026,
Please provide updated data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data?https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...Thank you.
- v-saisrao-msft3 months agoCommunity Support
HI fcb2026,
I'm checking to see if your issue has been resolved. If not, please send the updated data so we can help you resolve it.
Thank you.- fcb20263 months agoFrequent Visitor
Hi,
sorry for the delayed response — I was on holiday over the past few days.
Please find attached my example along with a screenshot illustrating my expected output.
Appreciate your support!!!
Best regards