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
Veigar
Frequent Visitor

Calculate sales order complexity

Hi everyone, 
I want to calculate how complex an order is.
Let me explain.

I have two tables:
ITEMS(ID_item, Warehouse_info)
SALES(ID_sales, ID_Order, ID_item)

ID_Item s are linked one to the other.
The warehouse info is a string like that "-A-B-" or "-C-" or "-A-B-C-".
ID_Sales is the key of the table, while ID_order is the code that groups many ID_Sales. Every ID_Sales has one only item, which is ID_Item.
I want to calculate the minimum number of warehouses that are needed to fulfill the order.

For example:

ITEMS
ID_Item       Warehouse_info
0004             "-A-B-"
0005             "-A-B-C-"
0006             "-A-C-"
0007             "-B-"

SALES
ID_sales         ID_Order        ID_item
S0001            O00001          0004
S0002            O00001          0005
S0003            O00002          0006
S0004            O00002          0004
S0005            O00003          0007
S0006            O00003          0004

I want that the measure will return (in a table):
ID_Order          Minimum WH Number
O00001            1 (Because the first item can be bought in A or B, and also the second)
O00002            1 (Because both can be bought in A)
O00003            2 (Because the first item is only stored in B, but i need another Warehouse for the second item, which is A or B)

Thanks

1 REPLY 1
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Veigar 

Not sure why O00003 needs 2, Item 0004 and 0007 can be stored in B, or the WH is like a sequential A-B-C, so it basically needs to be stored in A first? What if 0007 is -B- only, and 0004 is -B-C-? Then it is 1 or 2?

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.