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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Zx2000
Advocate I
Advocate I

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
1 REPLY 1
Greg_Deckler
Super User
Super User

@Zx2000 You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors