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
cdawidow
Helper III
Helper III

Need help creating a data model!

Hi guys, I am still new to power bi but I am having trouble modelling my relationships.  I have one column value (contract name) which is distinct and unique but everytime I set up a model I can only set it up as mant to many which in turn results in total sales calculations by contract name to be wrong . I am wondering if anybody had any advice on how I could set up my model appropriatly.  

 

contracts.PNG

 

This excel chart is just a snippet of the info I am trying to connect.  Any help would be appreciated !

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @cdawidow 

 

Generally, we don't recommend relating two fact-type tables directly using many-to-many cardinality. Instead of relating fact-type tables directly, we recommend you adopt Star Schema design principles. You do it by adding dimension-type tables. The dimension-type tables then relate to the fact-type tables by using one-to-many relationships. This design approach is robust as it delivers flexible reporting options. It lets you filter or group using any of the dimension-type columns, and summarize any related fact-type table. You may create a model like below.

 

b1.png

 

About many-to-many relationship guidance, I'd like to suggest you refer to the document  .

 

Best Regards

Allan

 

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

 

mahoneypat
Employee
Employee

When you look at your Contract column in Data View do it show that the # of distinct values is same as # of rows?  If not, you can do the following in the query editor on that column:

 

1. Remove blank rows

2. Remove duplicates

3. Also make sure there are not two values that are the same but differ in upper vs lower case (M is case sensitive but DAX/relationships are not.  If so, you can apply UPPERCASE or lowercase to that column before your Remove Duplicates step to address that.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.

Top Solution Authors
Top Kudoed Authors