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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
aysultaniya
Frequent Visitor

Sameperiod last year

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

selected date from the slicer (28th July to 1 Aug 2023).

Current period data seem good. But the same period last year's data is with all August data not only till 1st Aug.

Please help me how to solve the problem.

4 REPLIES 4
aysultaniya
Frequent Visitor

Last_period = CALCULATE([Measure_sum],SAMEPERIODLASTYEAR([date]))

 

yes, I have continuous dates from 2010 to 1st Aug. After that I have no data.

 

Table :-

date value
1/1/2010 5
1/2/2010 8
.
.
.
31/7/2022 8
1/08/2022 9
2/8/2022 10
.
.
.
.
.
.
31/7/2023 7
1/8/2023 3

date selected from slicer 31st July to 1st Aug.
the output should be current year 10 and last year 17
but output is current year 10 and last year's output is 31st July + the Sum of Aug month (not only 1 Aug)

If you create a table visual on your report and put the Date as the first column, then the [Measure_Sum] as the second, and as the third the [Last Period], if you look at the [Last Period] for any one date, what do you see for the [Measure Sum] for that date a year ago?

 

Date         SUM                Last Year

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

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

...

31/7/2023      7                ?
1/8/2023        3                 ?

 

And what is the date slice/filter you are using that generates the sum that includes all of August? 




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Slicer Selection :-
31st July 2023 to 1st Augusut 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 sum of the whole august not only the selected dates.

Remaining dates it is working good only last date of the data it is showing this error.

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

Both have same output.

ToddChitt
Super User
Super User

Can you give us a snipped of your data, plus the DAX formula you are using? What have you tried? Do you have a CONTIGUOUS Date Dimension in play?




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors