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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

First pass yield???

Hello everyone, I need help from you at how can I get the % pass that occurred the first time for each ID? Considering all the fields in the table.
IDLast TransactionResultStart timeEnd DateEnd Time
3530400909093823EIMAQC1Fail02/09/2021 14:582021-02-0914:59:21
3530400913383833EIMAQC1Pass02/09/2021 12:132021-02-0912:16:08
3530410994762253EIMAQC1Fail02/09/2021 15:152021-02-0915:15:18
3530430925023043EIMAQC1Fail02/09/2021 11:482021-02-0911:51:04
3530430925023043EIMAQC1Pass02/09/2021 12:222021-02-0912:22:58
3530430990547963EIMAQC1Pass02/09/2021 11:532021-02-0911:53:23
3530430990547963EIMAQC1Pass02/09/2021 12:162021-02-0912:16:46
3530430990547963EIMAQC1Fail02/09/2021 12:182021-02-0912:18:51
3530460966893243EIMAQC1Pass02/09/2021 11:572021-02-0912:00:32
3530460995785163EIMAQC1Pass02/09/2021 15:172021-02-0915:20:11
3530470965664623EIMAQC1Pass02/09/2021 08:162021-02-0908:19:18
3530480951576003EIMAQC1Fail02/09/2021 14:402021-02-0914:45:30
3530480995607343EIMAQC1Fail02/09/2021 11:412021-02-0911:46:12
3531451017193713EIMAQC1Pass02/09/2021 15:202021-02-0915:22:44
3548390986696023EIMAQC1Pass02/09/2021 15:042021-02-0915:04:28
3548490986176183EIMAQC1Fail02/09/2021 08:322021-02-0908:33:24
3548550903884963EIMAQC1Fail02/09/2021 10:002021-02-0910:00:29
3548550903884963EIMAQC1Pass02/09/2021 10:392021-02-0910:39:44
3548590920725613EIMAQC1Pass02/09/2021 10:282021-02-0910:29:09
3548610957703653EIMAQC1Pass02/09/2021 11:522021-02-0911:56:20
3548620958170993EIMAQC1Pass02/09/2021 08:452021-02-0908:47:53
3548650949527263EIMAQC1Fail02/09/2021 14:302021-02-0914:35:06
3548670921516243EIMAQC1Pass02/09/2021 08:482021-02-0908:51:36
3548670940993833EIMAQC1Pass02/09/2021 11:382021-02-0911:38:16
3548680940582543EIMAQC1Pass02/09/2021 09:492021-02-0909:53:06
3548680949356003EIMAQC1Fail02/09/2021 15:412021-02-0915:42:20
3548680953688013EIMAQC1Pass02/09/2021 15:042021-02-0915:11:03
3548680958981203EIMAQC1Pass02/09/2021 14:002021-02-0914:04:01
3548720959487603EIMAQC1Fail02/09/2021 10:362021-02-0910:36:46
3548720959487603EIMAQC1Fail02/09/2021 10:512021-02-0910:52:19
3548720959487603EIMAQC1Fail02/09/2021 14:252021-02-0914:25:24
3548730903850653EIMAQC1Pass02/09/2021 14:312021-02-0914:31:31
3548730950469363EIMAQC1Pass02/09/2021 10:472021-02-0910:51:32
3548760929481453EIMAQC1Pass02/09/2021 11:002021-02-0911:00:55
3548760961675023EIMAQC1Pass02/09/2021 15:112021-02-0915:16:46
3548770917517953EIMAQC1Pass02/09/2021 15:262021-02-0915:29:37
3548780957849723EIMAQC1Fail02/09/2021 09:462021-02-0909:46:25
3548780957849723EIMAQC1Fail02/09/2021 10:092021-02-0910:10:05
3548780957849723EIMAQC1Pass02/09/2021 11:132021-02-0911:13:35
3561650968258733EIMAQC1Pass02/09/2021 14:492021-02-0914:54:57
1 ACCEPTED SOLUTION
Anonymous
Not applicable

// T is the table from your post...

[Pass 1st Time (%)] = 
var IDsWithEarliestDates = 
// First, get for all visible ID's
// their minimum start times VISIBLE
// in the current context(!!!).
    ADDCOLUMNS(
        DISTINCT( T[ID] ),
        "@MinStartTime",
            CALCULATE(
                MIN( T[Start Time] )
            )
    )
var CountOfIDsWherePassIsFirst = 
// Calculate the number of ID's
// where the result for the first
// visible date, as calculated above,
// is "pass."
    CALCULATE(
        DISTINCTCOUNT( T[ID] ),
        TREATAS(
            IDsWithEarliestDates,
            T[ID],
            T[Start Time]
        ),
        KEEPFILTERS( T[Result] = "Pass" )
    )
var CountOfAllVisibleIDs =
// Get the number of all visible ID's.
    DISTINCTCOUNT( T[ID] )
var Result = 
    DIVIDE(
        CountOfIDsWherePassIsFirst,
        CountOfAllVisibleIDs
    )
RETURN
    Result

Be careful - this formula is sensitive to all filters you put on the table, meaning it respects them all, so the calculation above is carried out within the visible set of ID's with all the restricting filters.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

// T is the table from your post...

[Pass 1st Time (%)] = 
var IDsWithEarliestDates = 
// First, get for all visible ID's
// their minimum start times VISIBLE
// in the current context(!!!).
    ADDCOLUMNS(
        DISTINCT( T[ID] ),
        "@MinStartTime",
            CALCULATE(
                MIN( T[Start Time] )
            )
    )
var CountOfIDsWherePassIsFirst = 
// Calculate the number of ID's
// where the result for the first
// visible date, as calculated above,
// is "pass."
    CALCULATE(
        DISTINCTCOUNT( T[ID] ),
        TREATAS(
            IDsWithEarliestDates,
            T[ID],
            T[Start Time]
        ),
        KEEPFILTERS( T[Result] = "Pass" )
    )
var CountOfAllVisibleIDs =
// Get the number of all visible ID's.
    DISTINCTCOUNT( T[ID] )
var Result = 
    DIVIDE(
        CountOfIDsWherePassIsFirst,
        CountOfAllVisibleIDs
    )
RETURN
    Result

Be careful - this formula is sensitive to all filters you put on the table, meaning it respects them all, so the calculation above is carried out within the visible set of ID's with all the restricting filters.

amitchandak
Super User
Super User

@Anonymous , try a measure like


divide(calculate(countrows(Table), filter(Table, Table[Date] = calculate(Min(Table[Date]),allexpect(Table, Table[ID])) && Table[Result] ="Pass")),calculate(countrows(Table),Table[Result] ="Pass"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hello, this is my result: 

YATS_0-1618503160170.png

 

@Anonymous two )) should close after allexcept

 

check formula again

divide(calculate(countrows(Table), filter(Table, Table[Date] = calculate(Min(Table[Date]),allexpect(Table, Table[ID])) && Table[Result] ="Pass")),calculate(countrows(Table),Table[Result] ="Pass"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

YATS_0-1618515590036.png

but the result has to be: pass:36, fail: 19 so yield=65%

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.