Forum Discussion
Data_Tim
3 years agoNew Member
Help with SAMEPERIODLASTYEAR
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 toda...
- 3 years ago
Data_Tim
Appologies for that. Yes you are right this was supposed to be CALCULATETABLETickets 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" ) )
Data_Tim
3 years agoNew Member
Thanks for getting back to me tamerj1 .
Unfortunately that doesn't work as the Filter is expecting to evaluate DateTable[Date] not DateTable[Check]
tamerj1
3 years agoCommunity Champion
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" )
)