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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Creating a dimension table (with hierarchy)

Hello  -  I am using our Orders table to create a Family Code dimension table for our products.   (just referencing the table, and deleting all other columns).  

 

However, we also have a hierarchy.   

 

So, a particular type of product, goes under a family code, along with other related products. Something like:

Bikes:  Mountain Bikes,  Cruising Bikes,  Double-Seated Bikes  

Tents:  Round Tents,  Square Tents, Rectangle Tents

 

or 

 

Family Code    Product Code

 

HAPO                HAPO-A

                          HAPO-B

                          HAPO-C

LAPR                  LAPR-A

                          LAPR-B

                          LAPR-C

 

I was going to just keep these two columns for my Dim table, but then quickly realized I would not have unique values on the Family Code.     So, my question is, what is the best practice to create a dim table when you have hiearchies?  

 

Thanks in advance!

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You may have interest in this nice blog (Basics of Modeling in Power BI: What is a Dimension Table and Why Say No to a Single Big Table - RADACAD) to have a deeper understanding about a dimension table in a model. I learnt a lot from it. 

 

Regards,
Community Support Team _ Jing

HashamNiaz
Solution Sage
Solution Sage

Hi !

Try creating a [Family Code] dimension with only unique family code values either using DAX or Power Qury (M);

 

DimFamilyCode = DISTINCT(Table[Family Code])

 

You can treplave [Table] with your existing table name. Now you can create a 1-many relationship between [DimFamilyCode] & [Table] based on [Family Code] column.

 

This technique is called bridging table. Similary you need to have a dimension with Distinct Product code & connect this table to [Table] using 1-many relationship based on [Product Code] column.

 

Regards,

Hasham

CNENFRNL
Community Champion
Community Champion

For a dimension table, it's NOT necessarily to make each column contain distinct values.

Typically, take the most common time table for example, Year and Month columns usually contain repeated items whereas Date column is distinct; because the granularity of Date is what we pay attention to.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Yes, that makes sense.   So as long as at least one column contains unique values, and that is the key column, then it can be a dimension table, correct?

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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