Forum Discussion

azs's avatar
azs
New Member
5 years ago
Solved

DAX Measure Average Count over Time

Hi,   I am working with work order counts. Any work order is having a time stemp - opened, due to and closed - depending on "due to" and "closed" it can be evaluated, if the job was running overdue...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi azs 

    Due to I don't know your data model, I build a sample to have a test.

    Here I have two open days 2021/05/20 and 2021/05/24.

    2021/05/20 Part:

    2021/05/20: opened A;B;C;D --> overdue count 0

    2021/05/21: C is due to and closed as well; A&B&D are due to but not finished yet --> overdue count 3

    2021/05/22: A&B are overdue but closed; D is overdue but not closed --> overdue count 1

    2021/05/23: D is overdue but closed --> overdue count 0

    So the Averge count is (0+3+1+0)/ 4 = 1

    2021/05/20 Part is the same like yours.

    Measures:

    Diff Day = DATEDIFF(MAX('Table'[Due to]),MAX('Table'[Close]),DAY)
    Avg = 
    VAR _Overdue = SUMX('Table',[Diff Day])
    VAR _AllDaycount = DATEDIFF(MAX('Table'[Open]),MAX('Table'[Close]),DAY) +1
    VAR _Avg = DIVIDE(_Overdue,_AllDaycount)
    Return
    _Avg

    Result is as below.

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.