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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
toziu
Regular Visitor

question about sameperiodlastyear

This is my original form  sheet1

date             quantity

2017/1/1         1

2017/1/2         1

2017/1/3         1

2017/3/25       1

2018/3/5         1

 

then i use calendar(FIRSTDATE('Sheet1)'[date]),LASTDATE('(Sheet1)'[date]))) to create a table, it has dates from 2017/1/1 to 2018/3/5

 

create a function 

last year=CALCULATE(SUM('Sheet1'[quantity]),SAMEPERIODLASTYEAR('表'[Date]))

toziu_0-1701857176215.png

for 2018,why it shows 4?

the max day is 2018/3/5,Its previous year's date is 2017/3/5 ,sameperiodlastyear should return dates before,it should return 2017/1/1,2017/1/2,2017/1/3

why the result is 4?not 3?

1 ACCEPTED SOLUTION
Vallirajap
Resolver III
Resolver III

Hii @toziu 

In your scenario, you used the sameperiodlastyear function to calculate the quantity of the whole previous year, 2017.


sameperiodlastyear - It does not consider the date; it only considers the whole year.

 

Thank you

View solution in original post

1 REPLY 1
Vallirajap
Resolver III
Resolver III

Hii @toziu 

In your scenario, you used the sameperiodlastyear function to calculate the quantity of the whole previous year, 2017.


sameperiodlastyear - It does not consider the date; it only considers the whole year.

 

Thank you

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.