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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
murali5431
Helper III
Helper III

How to summarize based on success / failure

Hello,

 

I am working on a dataset that has entries as below.

 

My objective is to calcluate the % of successful entries / total number of entries.

Any entry is considered successful only if all rows corresponding to the Entry number show "Y". Even 1 "N" against an entry number makes it a failure. Please assist with a DAX measure to calculate the percentage.

 

For below example AA2, AA3 & AA5 are considered successful based on above logic and hence the result should be 3/5 - 60% 

Entry NumberSuccess / Failure
AA1Y
AA1N
AA2Y
AA3Y
AA3Y
AA4N
AA4Y
AA5Y
AA5Y

 

Thanks for the help!

6 REPLIES 6
harshnathani
Community Champion
Community Champion

Hi @murali5431 ,

 

You can try this as a measure.

 

Results =
VAR failuretable =
    SUMMARIZE (
        'Table',
        'Table'[Entry Number],
        "Failure", CALCULATE (
            MAX ( 'Table'[Success / Failure] ),
            'Table'[Success / Failure] = "N"
        )
    )
VAR finaltable =
    COUNTROWS (
        EXCEPT (
            failuretable,
            'Table'
        )
    )
VAR distinctrowsinmaintable =
    DISTINCTCOUNT ( 'Table'[Entry Number] )
RETURN
    DIVIDE (
        finaltable,
        distinctrowsinmaintable
    )

 

Pull the measure onto a card for your visualization.

 

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @harshnathani ,

 

Thanks for the response!

 

My table actually has around 25 columns of data. I had shared two columns as these are the only two that matter for the calclualton. This is probably causing an error "Each table argument of 'EXCEPT' must have the same number of columns.".

 

Could you advise a workaround for this?

 

Thanks,

Murali

Hi @murali5431 ,

 

 

Try this

 

Results =
VAR failuretable =
    SUMMARIZE (
        'Table4',
        Table4[Entry Number],
        "Failure", CALCULATE (
            MAX ( Table4[Success / Failure] ),
            'Table4'[Success / Failure] = "N"
        )
    )
VAR fin =
    SUMMARIZE (
        Table4,
        Table4[Entry Number],
        Table4[Success / Failure]
    )
VAR finaltable =
    COUNTROWS (
        EXCEPT (
            failuretable,
            fin
        )
    )
VAR distinctrowsinmaintable =
    DISTINCTCOUNT ( 'Table4'[Entry Number] )
RETURN
    DIVIDE (
        finaltable,
        distinctrowsinmaintable
    )

 

 

Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @murali5431 ,

 

Did the previous solution solve your issue.

 

If yes, please mark it as Solution for other users to benefit.

 

Regards,

HN

mahoneypat
Microsoft Employee
Microsoft Employee

Please try this expression that returns 60% for your example data.

 

Pct Successful =
VAR __summarytable =
    ADDCOLUMNS (
        VALUES ( Entry[Entry Number] ),
        "@N Count", CALCULATE ( COUNTROWS ( Entry ), Entry[Success / Failure] = "N" ) + 0
    )
RETURN
    DIVIDE (
        COUNTROWS ( FILTER ( __summarytable, [@N Count] = 0 ) ),
        COUNTROWS ( __summarytable )
    )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


lbendlin
Super User
Super User

Divide the distinct count of all entries that have a No by the distinct count of all entries. Then subtract that from 1.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.