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
mussaenda
Super User
Super User

One Order Date with Multiple Shipment Dates

I am a newbie in power bi and I am dealing with some problems.

 

I have 3 tables: Sales Table, Shipment Table, and Date Table.

In Sales Table, I have the the Order Date, Job Number, the Qty of the Order.

In Shipment Table, I have the Shipment Date, Job Number, the Qty of the Order shipped.

 

Sales Table

Sales Table.png

 

Shipment Table

 

Shipment Table.png

 

The scenario is, for some orders, there are multiple shipments made.

For example:

 

Job Number        Order Date          Qty of Order        Shipment Date        Qty of Order Shipped

1180001               1/1/18                  100,000               1/25/18                    25,000

                                                                                     2/10/18                    25,000

                                                                                     2/15/18                    25,000

                                                                                     3/31/18                    25,000

 

My problem is I cannot merge the 2 tables because when I tried, the qty of the order is duplicating based on the number of rows of the shipment table via job number.

 

What I needed is to calculate is the Open Quantity of Orders.

 

Month       Job Number       Qty Open

   1               1180001          75,000

   2               1180001          25,000

   3               1180001            0

 

 

Also, I need to track all the open orders of the previous years by week/month.

 

I tried to put the shipment date to the Sales Table and tried the formula below that I got here but it counts the qty as whole until reaching the final shipment date.

 

General Orders 2 = 
CALCULATE (
    [Total Weight],
    FILTER (
        GENERATE (
            SUMMARIZE (
                CALCULATETABLE('LTC ME$Sales Line New', ALL('Date Table')), 
                'LTC ME$Sales Line New'[LTC ME$Sales Header.Order Date],
                'LTC ME$Sales Line New'[Shipment Date]
            ),
            DATESBETWEEN (
                'Date Table'[Date],
                'LTC ME$Sales Line New'[LTC ME$Sales Header.Order Date],
                'LTC ME$Sales Line New'[Shipment Date]
            )
        ),
        CONTAINS ( VALUES ( 'Date Table'[Date] ), [Date], 'Date Table'[Date] )
    ),
    
	CROSSFILTER('Date Table'[Date], 'LTC ME$Sales Line New'[LTC ME$Sales Header.Order Date], None)
)

Total Weight is the Sum of Qty from Sales Table.

 

I've been dealing with this for over a week now. I hope someone will help me solve this problem.

 

Thank you,

Mussaenda

 

 

 

8 REPLIES 8
v-shex-msft
Community Support
Community Support

HI @mussaenda,

 

Please share some sample data for test to coding formula.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi, @v-shex-msft,

 

Here are the links of sample data. Thank you in advance!

 

Sales Table

 

Shipment Table

Hi @mussaenda ,

 

You can refer to following steps to create a matrix to achieve your requirement.

 

Steps:

1. Create a calculate table with combined order no as bridge.

 

Bridge =
DISTINCT (
    UNION ( VALUES ( Sales[Document No_] ), VALUES ( Shipment[Order No_] ) )
)

 

 

2. Build relationships from sale to bridge,  shipment to bridge based on order no.

 

3. Use above table fields to create matrix visual.

10.png


Regards,

Xiaoxin Sheng

 

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi, @v-shex-msft

 

Thank you for sharing your solution. Upon doing it, I noticed that you did not put the Qty ordered(from the Sales table) in the matrix. The main purpose of doing this is to deduct the Qty Base (Shipment Table) from Qty Base (Sales Table) to get the Outstanding/Open Qty with the dates involved.

 

Thank you,

Mussaenda

Hi @mussaenda ,


You can add another 'qty base' to value fields, rename these fields based their table name.(sale qty, shipment qty)

After these steps, you can add a measure to get diff from two qty and group by current category.

 

It will display remain qty which you wanted.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft,

 

Thank you for suggesting. I tried to add the order qty in the matrix but it is duplicating base on the rows of date. If you will enlighten me on grouping by current category, it will be a big help since I am a newbie. Bear with me.

 

See photo below, Thank you!

Untitled.png

 

 

 

Warm Regards,

Mussaenda

Hi @mussaenda,

 

You can drag this column row fields after order date, then it will display as total amount of shipment qty.(I rename two fields as sole qty and shipment qty)

20.png

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft,

 

Maybe my questions were not clear. Sorry for that. I will post a clearer question. Thank you for answering my question here, you are brilliant.

 

 

Mussaenda

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.