hierarchy and relationships

Forum home » Delegate support and help forum » Microsoft Power BI training and help » Hierarchy and relationships

Hierarchy and relationships

resolvedResolved · Medium Priority · Version 365

Hierarchy and relationships

Hi there,

I have 3 tables which hold categories and sub-categories as a hierarchy – not my model, but it came straight from mySQL like this:
- Category – categorID is the unique ID
- Sub-category – with categoryID as the FK
- Sub-sub-category with Sub-category ID as the FK

Then I have the main table ‘cases’ which have the following fields / values from the tables above:
- CategoryID
- Sub-CategoryID
- Sub-sub-category ID

I created a relationship between the 3 tables, so I can do some hierarchy matrix / report visual, and then created the relationship between each of those tables and ‘cases’. This won’t work, and will keep a relationship as ‘inactive’.

What’s the way around this?
I'd attach the diagram mockup, but can't see an option to add files to his, let me know if this would be helpful and where I can send it to.

Thank you,

Grazi

RE: Hierarchy and relationships

Hi Grazi,

Thank you for the forum question.

I have replicated a model and connected Power BI. Please find attached Power BI file. The 3 category tables shouldn't be related to each other. Just relate the 3 tables to the main table.


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Attached files...

subsubcat.pbix

Edited on Tue 19 Sep 2023, 16:04

RE: Hierarchy and relationships

Thank you Jens.

I can't see the Power BI file attached?

The problem I had by doing it by relating only the main table is that the counts didn't come correctly - since the counts are from the main table.

So the count from the main table doesn't know which sub or sub-sub categories it has since they're not related.

I'm keen to see your file to see if I'm doing something wrong.

Thank you so much, Grazi

RE: Hierarchy and relationships

Hi Jens, please ignore my last message. Once I logged in I managed to get the file and it works exactly as I need it to! :-)

I thought you meant linking the category tables instead of just the main one. It makes sense :-)

Thank you! Grazi

 

Training courses

 

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Power BI tip:

Utilize Relationships Effectively

Establish clear and meaningful relationships between tables in your data model. Proper relationships enable Power BI to navigate and aggregate data accurately. Pay attention to cardinality and cross-filter direction when setting up relationships to ensure the results align with your analytical requirements.

View all Power BI hints and tips


Server loaded in 0.08 secs.