Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Urgent Date interval same column

Hello, guys!   I need help to calculate a range of days for combining some of these statuses.   As an example: -ID 8944: The interval between the "new" and "prioritized" must be 6 days; -ID 896...
  • jdbuchanan71's avatar
    jdbuchanan71
    6 years ago

    Anonymous 

    If you change the measure to remove the -1 then the datediff will return blank for those with no new or prioritized date but then the number of days don't match what you had in your first post but they do match what you had in your second post.  The -1 was just there to force the calc to match your first post.

    Date Diff = 
    AVERAGEX(
        VALUES('MEDIAS STATUS'[Work Item Id]),
        (DATEDIFF(
            CALCULATE( MAX ( 'MEDIAS STATUS'[STATE DATE] ), ALLEXCEPT('MEDIAS STATUS','MEDIAS STATUS'[Work Item Id]),'MEDIAS STATUS'[State] = "New"),
            CALCULATE( MAX ( 'MEDIAS STATUS'[STATE DATE] ), ALLEXCEPT('MEDIAS STATUS','MEDIAS STATUS'[Work Item Id]),'MEDIAS STATUS'[State] = "Prioritized"),
            DAY ) )
    )