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

Measure Help!

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

Sure, please try this measure

Measure 1 = 
var _ZeroQty = COUNTROWS(CALCULATETABLE(VALUES('Table'[sales_order_number]),'Table'[OTIF]=0))
var _total = DISTINCTCOUNT('Table'[sales_order_number])
return
IF(ISINSCOPE('Table'[sales_order_number]),IF(_ZeroQty=0,1,0),1-DIVIDE(_ZeroQty,_total))

vjingzhanmsft_0-1718176417275.png

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

8 REPLIES 8
rajendraongole1
Super User
Super User

Hi @Anonymous - Can you use the below measure to get calcuate the "OTIF Without Dupes" correctly

This measure uses SUMMARIZE to create a temporary table that summarizes by Location ID and Sales Order, ensuring that the distinct count and filtering logic are correctly applied.

 

OTIF Without Dupes =
VAR OrdersTable =
SUMMARIZE(
'SalesTable',
'SalesTable'[Location ID],
'SalesTable'[Sales Order],
"OnTime", MAX('SalesTable'[OnTimeFlag])
)

VAR TotalOrders = COUNTROWS(OrdersTable)

VAR OnTimeOrders =
COUNTROWS(
FILTER(OrdersTable, [OnTime] = 1)
)

RETURN
DIVIDE(OnTimeOrders, TotalOrders, 0)

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

 

 

Hi @Anonymous - Modified to remove the filters in above measure can you try this?

 

OTIF Without Dupes V4 =
VAR OrdersTable =
SUMMARIZE(
'OTIF Showcase Sales order rollup',
'OTIF Showcase Sales order rollup'[Location ID_Desc],
'OTIF Showcase Sales order rollup'[sales_order_number],
"OnTime", MAX('OTIF Showcase Sales order rollup'[On time])
)

VAR TotalOrders =
CALCULATE(
COUNTROWS(OrdersTable),
REMOVEFILTERS('OTIF Showcase Sales order rollup'[sales_order_number])
)

VAR OnTimeOrders =
CALCULATE(
COUNTROWS(
FILTER(OrdersTable, [OnTime] = 1)
),
REMOVEFILTERS('OTIF Showcase Sales order rollup'[sales_order_number])
)

RETURN
DIVIDE(OnTimeOrders, TotalOrders, 0)

 

 

I hope it works, 

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

k

Anonymous
Not applicable

@rajendraongole1 , any advice on getting the above requirement added in the measure?

Anonymous
Not applicable

Hi @Anonymous 

 

Please check if this can meet your requirement. You can download the pbix to see details. 

vjingzhanmsft_0-1718092334113.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Anonymous
Not applicable

j

Anonymous
Not applicable

Hi @Anonymous 

 

Sure, please try this measure

Measure 1 = 
var _ZeroQty = COUNTROWS(CALCULATETABLE(VALUES('Table'[sales_order_number]),'Table'[OTIF]=0))
var _total = DISTINCTCOUNT('Table'[sales_order_number])
return
IF(ISINSCOPE('Table'[sales_order_number]),IF(_ZeroQty=0,1,0),1-DIVIDE(_ZeroQty,_total))

vjingzhanmsft_0-1718176417275.png

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

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.