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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
DennisSchlein
Helper III
Helper III

New to power bi / Simle dax

Hi 

Ive been trying for hours now to find the right way. But I can't.

I want to calclulate the share of parcels delivered on time.

I have a table, where the count of rows is my total.

Ex.:
ParcelNumber - CompletionDiffDays
12456               -             1
11123               -             0
13246               -             0



Co I want to count rows/ParcelNumber as total. Then all rows <0 = On time, the rest is delayed.

So this example would be 3 total, 1 delayed, 1 on time. So I want a card to display 66,6% on time.

But how to write the calculation?


1 ACCEPTED SOLUTION
DennisSchlein
Helper III
Helper III

I found out:

On time deliveries = (CALCULATE( COUNTROWS( 'Fact' ), FILTER( ALL('Fact'), 'Fact'[CompletionDiff] <= 0 ))/CALCULATE(COUNTROWS('Fact')))
 

View solution in original post

4 REPLIES 4
DennisSchlein
Helper III
Helper III

I found out:

On time deliveries = (CALCULATE( COUNTROWS( 'Fact' ), FILTER( ALL('Fact'), 'Fact'[CompletionDiff] <= 0 ))/CALCULATE(COUNTROWS('Fact')))
 
truptis
Community Champion
Community Champion

Hi @DennisSchlein , 

Your requirement is not very clear, especially the formula. Could you please give a proper example? 

Hi 
I have made this simple sample dataset.


So I want to count destinct tracking number - as total.
In this case, 28. Then all the parcel numbers with a CompletionDiff less or equal to 0 is on time.
So the on time share of the total? (sorry for the picture. I cannot figure how to insert two coloumns from excel and format it correctly. 

DennisSchlein_0-1647331930453.png

 


Kind regards



DennisSchlein
Helper III
Helper III

Was thinking something like this could have worked, but it doen't:

TotalShare = CALCULATE(DISTINCTCOUNT('Fact'[CompletionDiff]), 'Fact'[CompletionDiff] <= 0) / CALCULATE(COUNTROWS('Fact') )

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.