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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

SamePeriodLastYear error

Hi All,

 

I am doing a headcount report and would like to use the SamePeriodLastYear function to calculate last year headcount, however, the results are wrong and the numbers look strange. Any ideas?

 

headcount.JPGDAX.JPG

 

 

 

 

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

In the Table Visual, are you using the Month column from Calendar table?

Anonymous
Not applicable

i am using the "Month" in Calender table as the row content.

Anonymous
Not applicable

@v-piga-msft

I try to use the formula like below but no content:

 

PY.JPGresult.JPG

Hi @Anonymous,

 

Have you solved your problem?

 

If you have solved, could you please share your solution or always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous,

 

If it is convenient, could you share your data model so that I can test with your scenario.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous,

 

What about use the formula below?

 

py =
CALCULATE (
    SUM ( 'Table1'[Headcount] ),
    FILTER ( 'Table', YEAR ( 'Table'[Date] ) = YEAR ( MAX ( 'Table'[Date] ) ) - 1 )
)

Here is the output.

 last year value.png

 If you still want to use Time Intelligence functions for your case, please share some data sample and the relationship between the tables.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors