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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculation at Order Level

I have a matrix where I have a list of Orders (this can be expanded to see items for that order)

I need to create a measure to calculate the number of orders where the ASN = 100 % divide by the total of orders delivered
the problme is that this needs to be at order level not row by row, since row by row the ASN% variates and at order level we have a customm ASN

I tried used 
CALCULATE(DISTINCTCOUNT(ASN_Fact[invoice_nbr]),FILTER(ASN_Fact,ASN_Fact[ASN %] = 1 ))

but this is not working formesince its doing the calculation per each item not at order level

is there anyway to calculate this?

as an example the Route 00045949 has a total of 8 orders
at order level we can see that 5 orders has the 100% and the rest no
so the final result will be 

5 (perfect orders) / 8 (total orders ) = 0.62 (62%)

EduardoCED_0-1643072866748.png





1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new measure like

 

CALCULATE(countx(FILTER(values(ASN_Fact[invoice_nbr]),ASN_Fact,ASN_Fact[ASN %] = 1 ),[invoice_nbr]))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a new measure like

 

CALCULATE(countx(FILTER(values(ASN_Fact[invoice_nbr]),ASN_Fact,ASN_Fact[ASN %] = 1 ),[invoice_nbr]))

Anonymous
Not applicable

That work great, thank you


I have a similar formula but this one is used to filter by discrepancy

I tried to replicate the formula and it works until certain point due to some rows of the order have the disc = YES but the rest no, 

what can i do to solve this

if only 1 row has a disc = YES the whole order will be = YES 

in example below the users has 8 orders 

3 of the with chec in disc = YES but the matrix shows only FIRST value and the formula is making the calculation with tha first value even when the rest of the orders (2 of them) have the check in disc = YES 

so the fanl result will be 3 / 8 = 37.5 but the formula is makin

1 / 8 = 12.5%



EduardoCED_0-1643127717950.png
FIRST CHECK IN ISSUE

EduardoCED_1-1643127925810.png

 

LAST CHECK IN ISSUE

EduardoCED_2-1643127947500.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.