How can I count records captured in the previous month. I have a table with a date time column as seen in the image. Challenge is that the measure is not counting all records for the previous month (December 2019) yet we are in (January 2020). I believe issue might be with the year change. Below is my measure code for review.
CALCULATE(
IF(
ISBLANK(
COUNT(audit_requests[agent_id])), 0, COUNT(audit_requests[agent_id]
)
),
FILTER(
audit_requests,
YEAR(audit_requests[createdtime]) = IF(MONTH(TODAY()) = 1, YEAR(TODAY()) - 1, YEAR(TODAY())) &&
MONTH(audit_requests[createdtime]) = IF(MONTH(TODAY()) = 1, "12", MONTH(TODAY()))
)
)```