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

Best way to model many to many data problem

Hello Power BI Community,

 

I'm hoping for assistance with the below problem. I have two lookup tables showing the Department to which each product and region pertains, and a regions table showing to which region a store pertains. 

 

Product Table

 

RegionProductDepartment
GermanyVideogameMultimedia
FranceVideogameVisual Media
SpainVideogameGames, Toys and Boys Clothing
GermanyDVDMultimedia
FranceDVDVisual Media
FranceBasketballClothing and Sport
ItalyBasketballSports
GermanyLegoClothing, Sport and Toys
FranceLegoToys
PortugalLegoGames, Toys and Boys Clothing
GermanySocksClothing, Sport and Toys
ItalySocksClothes
SpainSocksGames, Toys and Boys Clothing

 

Region Table

 

RegionStore
GermanyBerlin
GermanyMunich
PortugalPorto
ItalyMilan
ItalyRome
SpainBarcelona
SpainMadrid
FranceParis
FranceMarseille

 

Finally, there is a facts table showing sales that have been made, by  product, store location, Qty, cost and total sale (Qty*cost).

 

Sales Table

 

QtyStoreItemPriceTotal
2BerlinDVD€10.00€20.00
1MadridVideogame€70.00€70.00
1ParisBasketball€30.00€30.00
2ParisDVD€10.00€20.00
3BerlinVideogame€70.00€210.00
1MunichDVD€10.00€10.00
1PortoLego€15.00€15.00
1MilanBasketball€30.00€30.00
1RomeBasketball€30.00€30.00
2BarcelonaSocks€5.00€10.00
1MadridVideogame€70.00€70.00

 

As part of the reporting requirement I need to determine sales by department, region and store (both independantly and in combinded tables). As you can see, joining the lookup tables with one another would create a many to many relationship of region to region. 

 

I would greatly appreciate if someone could assist on how this would best be modelled. Any suggestions whatsoever including DAX or Power Query solutions would also be appreciated.

 

Thanks in advance.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@walker4545 , Using Region Table( Merge In power query)  add Region to sales Table Create a combine key with Region and item

Create a key product table using region and product and then join these two tables using this new key

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @walker4545 ,

 

Refer to the following data model to see if it meets your requirements.

vhenrykmstf_1-1653380284845.png

vhenrykmstf_2-1653380308975.png

For more details, you can read related document.

Understand star schema and the importance for Power BI - Power BI | Microsoft Docs

 

If the problem is still not resolved, please point it out and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

@walker4545 , Using Region Table( Merge In power query)  add Region to sales Table Create a combine key with Region and item

Create a key product table using region and product and then join these two tables using this new key

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