Skip to main content
cancel
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.

Reply
aysultaniya
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.

4 REPLIES 4
lbendlin
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.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

DATEVALUE
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
Average72.5
Sum145
   
Ourput  
Average75.46
Sum14175

lbendlin_0-1693054319861.png

see attached

 

 

Helpful resources

Announcements
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

PBI_APRIL_CAROUSEL1

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.