Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Happy new year all!
I am trying to use the SAMPERIODLASTYEAR function to count records from the previous year, so that I can compare them to the number of records for the current year (up until today's date). The problem I am running into is that the same day last year is counting records for the entire month, rather than just that corresponding day.
I have a field in my Date table [check] which checks the day number of the year so future days in the same month can be filtered out.
Any help to resolve this would be greatly appreciated. Many thanks
Solved! Go to Solution.
@Data_Tim
Appologies for that. Yes you are right this was supposed to be CALCULATETABLE
Tickets LYTD =
CALCULATE (
COUNT ( 'All Tickets'[sys_id] ),
CALCULATETABLE (
SAMEPERIODLASTYEAR ( DateTable[Date] ),
DateTable[Check] = "True"
)
)
Or
Tickets LYTD =
CALCULATE (
COUNT ( 'All Tickets'[sys_id] ),
SAMEPERIODLASTYEAR ( DateTable[Date] ),
FILTER ( ALL ( DateTable ), DateTable[Check] = "True" )
)
Thanks for getting back to me @tamerj1 .
Unfortunately that doesn't work as the Filter is expecting to evaluate DateTable[Date] not DateTable[Check]
@Data_Tim
Appologies for that. Yes you are right this was supposed to be CALCULATETABLE
Tickets LYTD =
CALCULATE (
COUNT ( 'All Tickets'[sys_id] ),
CALCULATETABLE (
SAMEPERIODLASTYEAR ( DateTable[Date] ),
DateTable[Check] = "True"
)
)
Or
Tickets LYTD =
CALCULATE (
COUNT ( 'All Tickets'[sys_id] ),
SAMEPERIODLASTYEAR ( DateTable[Date] ),
FILTER ( ALL ( DateTable ), DateTable[Check] = "True" )
)
Hi @Data_Tim
Please try
Tickets LYTD =
CALCULATE (
COUNT ( 'All Tickets'[sys_id] ),
FILTER ( SAMEPERIODLASTYEAR ( DateTable[Date] ), DateTable[Check] = "True" )
)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 21 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 35 | |
| 31 | |
| 20 | |
| 13 | |
| 11 |