Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I have a technical problem that I cannot solve...
In my model I have two tables. one for Orders and one for Production records.
The table of orders contains, among other data, also the required quantity and the estimated date for shipment.
The table of production contains the production events in related to the different orders - quantities and their date.
For example I have order X for 6,000 units to be delivered at Aug 1, 2018 and at the Production table I can find the following related records for production:
For each order I would like to get the date that all required quantity of the order as been manufactured.
This shall be the earliest date that the fulfill the condition that all required units were produced.
(earliest date since we might produce an extra units).
At the example mentioned above the expected date shall be Aug 2
Any idea how it can be done ? by DAX or Power Query ? can it be a calculated column?
Thanks in advance.
assuming following tables structure
Order
Order | Quantity | DeliveryDate |
X | 6000 | 01/08/2018 |
Y | 500 | 02/07/2018 |
Production
Order | ProductionDate | Quantity |
X | 25/07/2018 | 2000 |
X | 26/07/2018 | 3000 |
X | 02/08/2018 | 1000 |
X | 03/08/2018 | 200 |
Y | 03/06/2018 | 300 |
Y | 04/06/2018 | 300 |
Y | 24/06/2018 | 300 |
this code will work as calculated column in Order
ProducedDate = VAR RequestedQuantity = 'Order'[Quantity] VAR AccumulatedProduction = ADDCOLUMNS ( Production, "ProducedQuantity", CALCULATE ( SUM ( Production[Quantity] ), FILTER ( Production, Production[Order] = EARLIER ( Production[Order] ) && Production[ProductionDate] <= EARLIER ( Production[ProductionDate] ) ) ) ) VAR CompletedProduction = FILTER ( AccumulatedProduction, [ProducedQuantity] >= RequestedQuantity ) RETURN CALCULATE ( FIRSTDATE ( Production[ProductionDate] ), CompletedProduction )
EDIT - I assume there is join between the tables on Order
Hi Stachu,
Thank you very much on your prompt reply.
Unfortunately this yield to me error of "there is not enough memory to complete the operation" so I cannot use this solution...
I think I need to provide some more info:
1. the table of production has many many records (it is large table...)
2. the relation between orders to production is one to many (many production records related to a single order)
3. I already have the following 2 measures:
Cumulative Production = CALCULATE ( [Total Production] ,FILTER (ALLSELECTED( Production ),Production[Date] <= MAX ( Production[Date] )) )
Order Cumulative Production = CALCULATE([Cumulative Production], FILTER(Production,Production[Date] <= LASTDATE(Orders[RequiredDate])))
Any other solution ?
Thanks in advance
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |