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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Online orders data schema

Hi all,

 

I'm trying to understand how to develop an effective data model to support my business needs. I understand that from research the star schema is one of the best methods, however I am unable to understand how to set up a model in this way.

 

Our database contains three key tables as outlined below:

1. Order table (all orders with OrderNo as PK) this includes total order price, total tax, total discounts, total shipping price etc.

2. OrderDetail table (all line items within each order) this includes the productID of each product, productTitle, orderno etc. 

3. Product table (all products in our store) including productID, product retail price, product cost, colour etc.

We would like to be able to choose an orderno in a slicer and then be able to see the line items within that order, including the total cost of the order (as looked up from order table > orderdetail > product), the total price of the order and all other relevant details. 

 

I have tried creating a relationship between Order table and OrderDetail table using OrderNo and OrderDetail table to Product table using ProductID however the product prices are not totalling correctly in a table visualisation.

Can you please suggest an appropriate schema or any modelling that I need to do in order to get this working correctly?

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous 

Could you share a sample without senstive data by your Onedrive for Business with me?

I need to know what kind of relationship between OrderDetail table and Order table/ Product table.

(One to One or one to many?)

And you can show me the result you want, this may make it easier for me to understand your requirement.

 

Best Regards,

Rico Zhou

 

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

 

amitchandak
Super User
Super User

@Anonymous , If product to order details is 1 to many

 

A new measure like

sumx(OrderDetail, related(Product[retail price]))

or
sumx(OrderDetail, related(Product[retail price])* OrderDetail[quantity])

or

sumx(relatedtable(Product),Product[retail price])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Super User
Super User

You need to bring the product price into the fact table, either with measure or calculated column. You can try adding a new column to the Order Detail table; 

 

Price = RELATED(Product[Price]) 

 

Then you can use that in the values in your visuals. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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
Top Kudoed Authors