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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
CaptRon
New Member

Calculating Same day shipping Metrics

Hi all,

I have two different data sources in one power bi report that i am looking to connect.  it is unfortunately a many to many relationship.  I am trying to find the % of lines shipped the same day and % of orders shipped the same day.  One of the tables has the order printed information and the other tabl

e has the order shipment information.  What is the best way to calculate this information? Each line is distinct by the order number and line number.  Is it possible to pull the shipment date from that table based on those two fields?  And create measures after that which calculated based on order date and shipment date matching?  Please help 🙂 

Pick NumberOrder NumberOrder TypeLine NUmberPart NumberOrder DateBranch 

101

1Sales Order1part 11/1/2022  
1022Sales Order1part 21/2/2022  
1033Sales Order1part 31/3/2022  
1044Sales Order1part 41/4/2022  
1055Sales Order1part 51/5/2022  

 

Pick NumberOrder NumberOrder TypeLine NumberPart NumberShip DateBranch 
1011Sales Order1Part 11/1/2022  
1022Sales Order1Part 21/4/2022  
1033Sales Order1Part 31/5/2022  
1044Sales Order1Part 41/6/2022  
1054Sales Order1Part 51/7/2022  

 

 Thank you!

1 ACCEPTED SOLUTION

Hi @CaptRon ,

 

Yes, you can use Append Query to combine these tables.

Append queries - Power Query | Microsoft Docs

 

And this will allow you to get the lasted data ( DirectQuery mode) as you said live information when you connect the data via using an ODBC from your SQL database.

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
AilleryO
Memorable Member
Memorable Member

Hi,

 

So you can do the merge using DAX :

 

TabShipAndOrder DAX = 
VAR TableOrder = SELECTCOLUMNS(TabOrder, "OrderNum" , TabOrder[Order Number], "DateOrder" , TabOrder[Order Date]) //Choose columns you need in Order
VAR TableShipment = SELECTCOLUMNS( TabShipment , "ShipDate" , TabShipment[Ship Date] )
VAR MergeTable = GENERATEALL( TableOrder , TableShipment ) // To merge both table using FullOuter
RETURN
ADDCOLUMNS( MergeTable , "SameDayShipment_Test" , IF( [DateOrder] = [ShipDate] , 1 , 0) )
 
In both variables you can add columns as much as you need, just be careful not to have same name in both tables.
GENERATEALL is one of the "equivalent" of FullOuter merge in Power Query (along with GENERATE or CROSSJOIN).
 
Then you can sum up the column SameDayShipment_Test. 
 
Let us know if it works

 

CaptRon
New Member

Hi @AilleryO ,

 

Both of my tables are connected to power BI using an ODBC from our SQL database.  If i connect it to excel and use power query instead and connect Power BI to the power query will i still be able to refresh the data to give live information once the report has published?

Hi @CaptRon ,

 

Yes, you can use Append Query to combine these tables.

Append queries - Power Query | Microsoft Docs

 

And this will allow you to get the lasted data ( DirectQuery mode) as you said live information when you connect the data via using an ODBC from your SQL database.

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AilleryO
Memorable Member
Memorable Member

Hi,

 

My suggestion would be to use Power Query to merge your tables, and bring back the ship date in your table of orders.

Then you can create a conditionnal conlumn to test if the value is the same in both columns to place a one or a zero on the lines of your table.

By summing up its column you'll get the count of shipment made the same day.

 

If you need more details about this solution pleace let me know qhat is not clear for you.

 

Hope it helps

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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