Forum Discussion

Zx2000's avatar
Zx2000
Icon for Advocate I rankAdvocate I
3 years ago

SAMEPERDIOLASTYEAR strange result

I am not going prsent the whole picture of calculations as it has no point so... going straigt to the point.

My date table ends at 27.01.2023. If I create a table with DETESYTD it has 27 records - correct and clear. But when I create another table based on this previous table and with SAMEPPERIODLASTYEAR it results with 31 records from a year before? WHY? Why not 27?  It should result in same number of days like in the first table provided to calculations but with year shifted -1 (2022) for every single record (27). It results in all dates from January from previous year (31).  


test 1 =
VAR x1 = DATESYTD(Daty[Date]) -- There are 27 days in my January date table for 2023 (correct). So this table  contains 27 rows
VAR x2 = COUNTROWS(x1)--it equals 27
VAR x3 = SAMEPERIODLASTYEAR(x1) -I hope for the first table but with year -1 
VAR x4 = COUNTROWS(x3) -- it equals 31. Why? It should be 27 by with year -1
RETURN
x4