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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors