Forum Discussion

IAM's avatar
IAM
Helper III
4 years ago
Solved

Solution without extra columns?

Hi all,   Hope you can help me design something without adding extra columns.   I want to see the average days between 3 different statuses per employee. Between date creation -> planned -> act...
  • v-chenwuz-msft's avatar
    4 years ago

    Hi IAM ,

     

    We assum data looks like this:

    create a measure to calculate the average days.

    Measure =
    VAR _s1 = "creation"
    VAR _s2 = "planned"
    VAR _s3 = "actual"
    VAR _s1_s2 =
        VALUE (
            CALCULATE (
                MAX ( 'Table'[start date] ),
                FILTER ( ALLSELECTED ( 'Table'[status] ), [status] = _s2 )
            )
                - CALCULATE (
                    MAX ( 'Table'[start date] ),
                    FILTER ( ALLSELECTED ( 'Table'[status] ), [status] = _s1 )
                )
        )
    VAR _s2_s3 =
        VALUE (
            CALCULATE (
                MAX ( 'Table'[start date] ),
                FILTER ( ALLSELECTED ( 'Table'[status] ), [status] = _s3 )
            )
                - CALCULATE (
                    MAX ( 'Table'[start date] ),
                    FILTER ( ALLSELECTED ( 'Table'[status] ), [status] = _s2 )
                )
        )
    RETURN
        DIVIDE ( _s1_s2 + _s2_s3, 2 )
    

     

    Pbix file in the end and hope this  helpful.

     

    Best Regards

    Community Support Team _ chenwu zhu

     

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