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
Anonymous
Not applicable

Same period last year not working

Hi 

 

I have a report where the sameperiodlast year measure isnt working. I am getting the result for the full year 2018 rather than Jan 18. 

 

total billed = sum('Recruitment Live'[BILL_AMOUNT])

calendar = CALENDAR(date(2018, 1, 1), date(2019, 12, 31))

2018 = CALCULATE([total billed],SAMEPERIODLASTYEAR('calendar'[Date]))

 

what has me stumped is that the report worked correctly when i had the calendar set for 2017 -2018 dates 

 

calendar = CALENDAR(date(2017, 1, 1), date(2018, 12, 31))

 

what could i be missing?

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can also refer to following link to manually set up filter date range for calculation:

Time Intelligence "The Hard Way" (TITHW)

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can also refer to following link to manually set up filter date range for calculation:

Time Intelligence "The Hard Way" (TITHW)

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
MariaP
Solution Supplier
Solution Supplier

Hi Ludzie,

 

SAMEPERIOSLASTYEAR will return a set of dates shifted one year back in time. This is a special variation on DATEADD.

 

totalBilled_PY= CALCULATE(  [Bill_Amount], SAMEPERIODLASTYEAR( 'Calendar'[Date] ) )

 

OR

 

 PY_totalBilled =  CALCULATE(  [Bill_Amount], DATEADD(  ( 'Calendar'[Date]., -1, YEAR  ) )

 

You have to make sure your calendar table includes dates for the previous year in order for the comparison to be made. Your calnedar tabl sholuld contain dates to cover the dates in your Recruitment_Live table.

Anonymous
Not applicable

Yes thats what i am expecting i.e i should see the results as at Jan 2018 but i am getting the total bill amount for 2018 (Jan-dec)

 

I have changed the calendar from the above to calendarauto to ensure the range of recruitment_live  is covered 

 

 

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.