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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SignorSoprano
Helper I
Helper I

Help with data model format of hierarchical data

Hi, all,

 

I'm just seeking advise on a best practice pertaining to the structure of tables in the data model, as it relates to slicers and hierarchical data.

 

For example, I have an employee table similar to the following:

 

Employee IDEmployee NameSupervisor IDRegionMarket

101

This Guy   
204That Guy201NortheastEnvironmental
105Other Guy101WestDesign
201Another Guy101NortheastEnvironmental

 

 

And say I want slicers in my report for 'Region', 'Market' and 'Supervisor', such that if I choose a specific 'Region', the 'Market' and 'Supervisor' slicers will update to show only those employees in that specific 'Region'. And so on for the other slicers.

 

However, in the 'Supervisor' slicer, I want to show the supervisor's name and not his/her ID. What is the best way to handle this? Should I create a separate supervisor table like such:

 

Supervisor KeySupervisor Name
1This Guy
2Another Guy

 

And use the 'Supervisor Key' in the first table instead of 'Supervisor ID' and use this 'Supervisor Name' as the data source for the 'Supervisor' slicer?

 

This would remove the hierarchical structure of the original table, however, and I would like to preserve it. In that case, should I just add an additional column in the first table and have it be the 'Supervisor Key' and relate it to the 'Supervisor Key' in this separate supervisor table?

 

Thanks for your advice.

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @SignorSoprano ,

A straightforward way to solve this problem is to create a calulated column to save supervisor name and use it as the slicer:

Supervisor Name = 
SWITCH(
    TRUE(),
    'Table'[Supervisor ID] = 101, "This Guy",
    'Table'[Supervisor ID] = 201, "Another Guy",
    'Table'[Supervisor ID] = 105, "Other Guy",
    'Table'[Supervisor ID] = 204, "That Guy", 
    "Others"
)

slicers.png

 

Best Regards,
Yingjie Li

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

 

View solution in original post

4 REPLIES 4
v-yingjl
Community Support
Community Support

Hi @SignorSoprano ,

A straightforward way to solve this problem is to create a calulated column to save supervisor name and use it as the slicer:

Supervisor Name = 
SWITCH(
    TRUE(),
    'Table'[Supervisor ID] = 101, "This Guy",
    'Table'[Supervisor ID] = 201, "Another Guy",
    'Table'[Supervisor ID] = 105, "Other Guy",
    'Table'[Supervisor ID] = 204, "That Guy", 
    "Others"
)

slicers.png

 

Best Regards,
Yingjie Li

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

 

In short, I should just add another column in the original table named 'Supervisor Name'? This will work. I just didn't know what was best practice.

 

However, the DAX code with the switch statement is not feasible as the list of supervisors numbers in the hundreds. But, I can just add the 'Supervisor Name' column in my data source.

 

Thanks, @v-yingjl 

Hi @SignorSoprano ,

You can use lookupvalue() function to create a calculated column:

Column = 
LOOKUPVALUE('Table'[Employee Name],'Table'[Employee ID],'Table'[Supervisor ID])

lookupvalue.png

 

Best Regards,
Yingjie Li

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

Yep, I sure can. Thanks for your advice.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.