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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Frequent Visitor

sameperiodlast year

 It is urgent please help


I have data till 1st Aug 2023 in an Excel sheet. The remaining sheet is blank below the 1st AUg.

Slicer Selection:-
31st July 2023 to 1st August 2023

Date SUM Last Year

----- ------ --------

31/7/2022 8
1/08/2022 9


31/7/2023 7 8
1/8/2023 3 9

Required output Current_year 10 and last_year 17

But the output of last year is not 17 (more than this) because It is the sum of the whole of August not only the selected dates.

The remaining dates it is working well only the last date of the data is showing this error.

DAX Query Last_year = CALCULATE([Measure_sum],SAMEPERIODLASTYEAR([date]))
Also Used CALCULATE([Measure_sum],date add([date], -1, year))

Both have the same output.

Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
Please show the expected outcome based on the sample data you provided.

Sun 31-Jul-222
Mon 01-Aug-223
Tue 02-Aug-224
Wed 03-Aug-225
Thu 04-Aug-226
Fri 05-Aug-227
Sat 06-Aug-228
Sun 07-Aug-229
Mon 08-Aug-222
Tue 09-Aug-223
Wed 10-Aug-224
Thu 11-Aug-225
Fri 12-Aug-226
Sat 13-Aug-227
Sun 14-Aug-228
Mon 15-Aug-229
Tue 16-Aug-222
Wed 17-Aug-223
Thu 18-Aug-224
Fri 19-Aug-225
Sat 20-Aug-226
Sun 21-Aug-227
Mon 22-Aug-228
Tue 23-Aug-229
Wed 24-Aug-222
Thu 25-Aug-223
Fri 26-Aug-224
Sat 27-Aug-225
Sun 28-Aug-226
Mon 29-Aug-227
Tue 30-Aug-228
Wed 31-Aug-228
Mon 31-Jul-239
Tue 01-Aug-235

 Date selected in slicer is 31st July 2023 to 1 August 2023 
Expected Output  (31st August 2023 to 1 August 2023)Output  Sameperiod last year function output


see attached



Helpful resources

Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City


Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.