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

Sameperiodlastyear for Month is not working

Currently, I have data (January 2020 through February 2021) and when I write this formula:

 

Distinct Headcount = CALCULATE(DISTINCTCOUNTNOBLANK(Table1[EE Number]),DATESMTD(Table1[Date]))
 
I get the count I am expecting for February 2021 as this is my MTD for 2021. But when I try writing a formula  to get my 2020 MTD value, expecting that it will give me the February 2020 count using either SamePeriodLastYear or DateADD, the result I am getting is from December 2020 and not February 2020.
 
I am not using, nor do i want to, a slider for dates. I want to be able to get the distinct count from a year ago which would be February 2020's distinct count.
I have also tried using a calendar table due to the contiguous issue and and I still get the same result-the December 2020 count.
This formula should work and display March counts when I add March 2021 data and bring back March 2020 data.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I still think the solution can be streamlined, but found a workaround here:

 

Solved: SAMEPERIODLASTYEAR() - Microsoft Power BI Community

 

Thank you @BA_Pete 

View solution in original post

3 REPLIES 3
AntrikshSharma
Community Champion
Community Champion

@Anonymous The problem could be because you are using dates from a fact table, please create a proper date table in your model. For time intelligence calculations there model should always have a proper dates table.

Anonymous
Not applicable

I still think the solution can be streamlined, but found a workaround here:

 

Solved: SAMEPERIODLASTYEAR() - Microsoft Power BI Community

 

Thank you @BA_Pete 

Anonymous
Not applicable

@AntrikshSharma I did create the table and that still did not work. I mention the date table as a calendar table.

 

"I have also tried using a calendar table due to the contiguous issue and and I still get the same result-the December 2020 count."

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