Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I have a single PO with multiple order lines.
Out of 3 lines, only 2 met on time delivery in full (OTIF).
On purchase order level, this order does not meet the OTIF, zero
How can I calculate this using Dax?
I tried below but this gives me OTIF =1
Solved! Go to Solution.
Hi , @dogburalHK82
According to your description, you want to filter the OTIF by Purchase Order side.
Here are the steps you can refer to :
(1)This is my test data:
(2)We can create a measure like this:
Measure = var _t = ADDCOLUMNS('Table',"flag" , IF([Promised Date]>[Receipt Date] ,0,1))
var _t2 = ADDCOLUMNS(_t , "flag2",var _order =[Purchase Order] var _sum=SUMX( FILTER(_t,[Purchase Order]=_order),[flag]) return IF(_sum>0 ,1,0))
var _end_table = FILTER(_t2 , [flag2]=0)
var _end_table2 = FILTER( SUMMARIZE(_end_table,'Table'[Purchase Order] , "backorder" , SUM([Backorder])) , [backorder]=0)
return
COUNTROWS(_end_table2)
Then we can meet your need , the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @dogburalHK82
According to your description, you want to filter the OTIF by Purchase Order side.
Here are the steps you can refer to :
(1)This is my test data:
(2)We can create a measure like this:
Measure = var _t = ADDCOLUMNS('Table',"flag" , IF([Promised Date]>[Receipt Date] ,0,1))
var _t2 = ADDCOLUMNS(_t , "flag2",var _order =[Purchase Order] var _sum=SUMX( FILTER(_t,[Purchase Order]=_order),[flag]) return IF(_sum>0 ,1,0))
var _end_table = FILTER(_t2 , [flag2]=0)
var _end_table2 = FILTER( SUMMARIZE(_end_table,'Table'[Purchase Order] , "backorder" , SUM([Backorder])) , [backorder]=0)
return
COUNTROWS(_end_table2)
Then we can meet your need , the result is as follows:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
9 |