Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kormosb
Helper III
Helper III

'd like to get help with DAX

Hi,

 

I have an issue/bug list from testing a system where I'd like to calculate the average days of an issue being in the same status.

 

I managed to calculate it with EARLIER:

 

Days of being in the same status = DATEDIFF([Modify date], MINX(FILTER('Issue list','Issue list'[Issue ID]=EARLIER('Issue list'[Issue ID]) && [Modify date]>EARLIER([Modify date])),[Modify date]),DAY)

 

Unfortunately I can't handle those kind of issues, where we've modified the issue somehow (in that case added a responsible person) but haven't changed the status (stayed "new"), the average calculates wrong:

Issue_help.JPG

 

Please find attached the PBI file for the data and example.

 

Thanks in advance,

 

Kind regards,

Benjamin

1 ACCEPTED SOLUTION

Hi @kormosb ,

 

You may change the measure like Measure 3 below, which uses the SUM function. And if the 'Issue list'[Days of being in the same status-average] is a measure , then you can change it like Measure 4 below.

 

Measure 3 =
CALCULATE (
    SUM( 'Issue list'[Days of being in the same status-average] ),
    FILTER (
        ALLSELECTED ( 'Issue list' ),
        'Issue list'[Status] = MAX ( 'Issue list'[Status] )
    )
)



Measure 4 =
CALCULATE (
    SUMX( 'Issue list', [Days of being in the same status-average] ),
    FILTER (
        ALLSELECTED ( 'Issue list' ),
        'Issue list'[Status] = MAX ( 'Issue list'[Status] )
    )
)

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

View solution in original post

5 REPLIES 5
v-xicai
Community Support
Community Support

Hi @kormosb ,

 

You may create measure like DAX below.

 

Measure 3 =
CALCULATE (
    AVERAGE ( 'Issue list'[Days of being in the same status] ),
    FILTER (
        ALLSELECTED ( 'Issue list' ),
        'Issue list'[Status] = MAX ( 'Issue list'[Status] )
    )
)

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

Hi @v-xicai 

 

Thanks for the idea, but it doesn't solve my original problem.

As you can see in the picture, your measure 3 calculates the average (23,33), but in thatcase I should get 32, as you can see in the explanation in the red text box.

kormosb_0-1596802956553.png

 

Hi @kormosb ,

 

You may change the measure like Measure 3 below, which uses the SUM function. And if the 'Issue list'[Days of being in the same status-average] is a measure , then you can change it like Measure 4 below.

 

Measure 3 =
CALCULATE (
    SUM( 'Issue list'[Days of being in the same status-average] ),
    FILTER (
        ALLSELECTED ( 'Issue list' ),
        'Issue list'[Status] = MAX ( 'Issue list'[Status] )
    )
)



Measure 4 =
CALCULATE (
    SUMX( 'Issue list', [Days of being in the same status-average] ),
    FILTER (
        ALLSELECTED ( 'Issue list' ),
        'Issue list'[Status] = MAX ( 'Issue list'[Status] )
    )
)

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

amitchandak
Super User
Super User

@kormosb , Try a measure like this

Measure = AVERAGEX(values('Issue list'[Status]),sumX(SUMMARIZE('Issue list','Issue list'[Status],'Issue list'[Modify date],"_1",AVERAGE('Issue list'[Days of being in the same status])),[_1]))

Hi,

Thanks, we came closer solving the problem, it is working if I filter for one issue/bug.

Although, when I want to see the average for all the issues (remove the filter) the measure is adding the numbers the wrong way:

kormosb_0-1596721835807.png

So generally, I would like to calculate the average days of an issue being in the same status. So for example, on average the issues are in "New" status for 28,5 days, in "Waiting" status 11,2 days, and so on for all the statuses. Maybe my original calculated column is not good for this calculation.

 

I wonder if you can help me with this @amitchandak ? (I updated the PBI file)

 

Thanks,

Benjamin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors