I have a table of defect data that I would like to create a MEASURE that gives me a count of defects for each month. I know I need to use a date table but my attempts thus far haven't worked out.
What I am looking for when this works is a simple count by month:
January 125 February 225 March 220 April 120
Here is the Measure I was trying to build without any luck...
Monthly Defects =
// TOTALYTD(COUNT(Defects[Defect]), 'Date'[Date])
VAR defectDate = FIRSTDATE(Defects[Created Date])
VAR defectYear = YEAR(defectDate)
VAR defectMonth = MONTH(defectDate)
RETURN
CALCULATE (
COUNT(Defects[Defect]),
FILTER (
Defects,
Defects[Created Date] <= defectDate &&
(YEAR (Defects[Created Date]) = defectYear) && (MONTH(Defects[Created Date]) = defectMonth)
)
)
Here is what I am looking to do in the end.