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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

count multiple rows together

Hi !

 

I have a table named ShipDetails that looks like this :

 

DROPON_TIME_DELIVERYORDERED_PRODUCT
Client 1 - Order 1OKProduct 2
Client 1 - Order 1OKProduct 4
Client 2 - Order 1KOProduct 1
Client 2 - Order 1KOProduct 2
Client 2 - Order 1KOProduct 3
C1 - O2KOProduct 3
C1 - O3OKProduct 3
C1 - O3OKProduct 4

 

I would like to create a measure that count the percentage of on time delivery.

In order to do that, I have to count 1 if ON-TIME_DELIVERY is "OK" and 0 if it's "KO", FOR EACH DROP (and then divide by the number of distinct drops).

It's easy to do it for each row, but, here, rows of the same drop have to be counted only as 1.

How could I do it ?

(I tried several measures like this one but it doesn't work at all : On time delivery (%) = CALCULATE(SUMX(ShipDetails,IF(ShipDetails[ON_TIME_DELIVERY]="OK",1,0)),ALLEXCEPT(ShipDetails,ShipDetails[DROP]))/DISTINCTCOUNT(ShipDetails[DROP]))

 

Thank you for your help,

 

Regards,

Marion

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try this.

On time delivery (%) = 
DIVIDE(
    CALCULATE(
        DISTINCTCOUNT( ShipDetails[DROP] ), 
        ShipDetails[ON_TIME_DELIVERY] = "OK" 
    ),
    DISTINCTCOUNT ( ShipDetails[DROP] )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try this.

On time delivery (%) = 
DIVIDE(
    CALCULATE(
        DISTINCTCOUNT( ShipDetails[DROP] ), 
        ShipDetails[ON_TIME_DELIVERY] = "OK" 
    ),
    DISTINCTCOUNT ( ShipDetails[DROP] )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.