dax - PowerBI - Measure to Summarize Daily data into Monthly Counts -


i have table of defect data create measure gives me count of defects each month. know need use date table attempts far haven't worked out.

what looking when works simple count month:

january 125 february 225 march 220 april 120

defect table enter image description here

date table enter image description here

here measure trying build without 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 looking in end.

enter image description here

if want count per month, measure should

monthly defects=countrows(defects) 

this assuming have relationship between defect table , date table.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -