Forum Discussion

king98027's avatar
king98027
Frequent Visitor
4 years ago
Solved

First Time Fix Rate

Hello, I'm trying to get a specific metric called "First Time Fix Rate" working within my report. I am a bit newer when it comes to DAX expressions and tried to follow a specific procedure I found...
  • Anonymous's avatar
    Anonymous
    4 years ago

    HI king98027,

    You can use the following measure formulas to get the fist time flag and rate:

    First time Flag =
    VAR currDate =
        MAX ( Table[Created Date] )
    VAR last7dayCount =
        CALCULATE (
            COUNT ( Table[Work Order Number] ),
            FILTER (
                ALLSELECTED ( Table ),
                [Created Date] < currDate
                    && [Created Date] >= currDate - 7
            ),
            VALUES ( Table[Serial Number] )
        )
    RETURN
        IF ( last7dayCount > 1, 0, 1 )
    first time rate =
    VAR currSerialNumber =
        VALUES ( Table[Serial Number] )
    VAR summary =
        SUMMARIZE (
            Table,
            [Serial Number],
            [Work Order Number],
            [Created Date],
            "Flag",
                VAR last7dayCount =
                    COUNTX (
                        FILTER (
                            ALLSELECTED ( Table ),
                            [Serial Number] = EARLIER ( Table[Serial Number] )
                                && [Created Date] < EARLIER ( Table[Created Date] )
                                && [Created Date]
                                    >= EARLIER ( Table[Created Date] ) - 7
                        ),
                        [Work Order Number]
                    )
                RETURN
                    IF ( last7dayCount > 1, 0, 1 )
        )
    RETURN
        DIVIDE ( SUMX ( summary, [Flag] ), COUNTROWS ( summary ) )

    Regards,

    Xiaoxin Sheng