Forum Discussion

JulietZhu's avatar
JulietZhu
Helper IV
7 years ago
Solved

DAX help for Count task based on aging bucket

I have total task created in selected month. Also I need calcuated task aging bucket. For example, for aging bucket 30-60, I need count taskid if datediff of (createddate and month end day) <60 and datediff of (createddate and month end day) > 30.

 The following DAX is used, but it is not working. Please advice. Thanks

 

TaskCreated30-60 =
var _SelectDate=SELECTEDVALUE('Date'[Date],max('Date'[Date]))
return
If (Datediff(Task[createddate],_selectedDate,day) >= 31 && Datediff(Task[createddate],_selectedDate,day)<60, 

    ,CALCULATE(Task[TaskCreated]))

 

Dummy data link

https://1drv.ms/u/s!AlYpYKwSuOKxhFduK3PetlnD08b1

 

 

  • AlB, I would be able to figure it out my self.  I put DAX here as your reference. Thanks for your help 

     

    TaskOutstanding 30-60 = 
    VAR EndDate = MAX ( 'Date'[Date] )
    RETURN
    IF (MIN ( 'Date'[Date] )<= CALCULATE ( MAX ('Task'[CreatedDate]), ALL ('Date') ), CALCULATE ([TaskOutstanding],FILTER ( ALL ( 'date'[Date] ), 'Date'[Date] <= EndDate ),
    KEEPFILTERS (
    IFERROR (DATEDIFF (Task[CreatedDate] , EndDate, DAY ),( DATEDIFF ( EndDate, Task[CreatedDate], DAY ) ) * -1) <= 60 &&
    IFERROR(DATEDIFF (Task[CreatedDate] , EndDate, DAY ),(DATEDIFF ( EndDate, Task[CreatedDate], DAY ) ) * -1) >=31
    )
    )
    )

19 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi JulietZhu

    Out of curiosity, what are you trying to do with the outer CALCULATE?

      • AlB's avatar
        AlB
        Community Champion

        JulietZhu

        I do not quite understand what the measure has to deliver. Could you explain a bit more?