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
PBIfanatic
Helper V
Helper V

Hierarchy selection

Hi, 

 

My data structure looks like this, SKU3 will contain  all 3 levels. 

 

SKU1(Parent)SKU2(Child1)SKU3(Child2)
HTC1HTC1HTC1
Apple1Apple1Apple1
Apple1Apple1Apple4
Apple1Apple1Apple5
Samsung1Samsung2Samsung3

 

Creating a hierarchy and placing in the slicer gives this

 

PBIfanatic_0-1634507524461.png

Can this be showed where the value doesnt repeat itself?

PBIfanatic_1-1634507569101.png

thanks 

1 ACCEPTED SOLUTION
TheoC
Super User
Super User

Hi @PBIfanatic, it can be done a few ways, one of which is by creating a calculated column and just using an IF statement. For exmaple, the below two calculated columns will get you what you want:

 

Child_1 = IF ( PBI_Table2[SKU2(Child1)] = PBI_Table2[SKU1(Parent)] , "" , PBI_Table2[SKU2(Child1)] )
Child_2 = IF ( PBI_Table2[SKU3(Child2)] = PBI_Table2[SKU1(Parent)] , "" , PBI_Table2[SKU3(Child2)] )

TheoC_0-1634510242498.png

To achieve your example, I didn't need to bring in Child_1, however, if you are to add many more rows, it is likely you will need to bring them in.

 

TheoC_1-1634510376240.png

 

Also, just as an FYI, if you have three specific columns such as that which you have presented as an example (i.e. Parent, Child1, Child2), you could use Power Query to Unpivot your tables and create the following very easily (however, it may not be what you want?).

 

TheoC_2-1634510482923.png

Anyway, hope one or the other help 🙂

 

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

4 REPLIES 4
TheoC
Super User
Super User

Hi @PBIfanatic, it can be done a few ways, one of which is by creating a calculated column and just using an IF statement. For exmaple, the below two calculated columns will get you what you want:

 

Child_1 = IF ( PBI_Table2[SKU2(Child1)] = PBI_Table2[SKU1(Parent)] , "" , PBI_Table2[SKU2(Child1)] )
Child_2 = IF ( PBI_Table2[SKU3(Child2)] = PBI_Table2[SKU1(Parent)] , "" , PBI_Table2[SKU3(Child2)] )

TheoC_0-1634510242498.png

To achieve your example, I didn't need to bring in Child_1, however, if you are to add many more rows, it is likely you will need to bring them in.

 

TheoC_1-1634510376240.png

 

Also, just as an FYI, if you have three specific columns such as that which you have presented as an example (i.e. Parent, Child1, Child2), you could use Power Query to Unpivot your tables and create the following very easily (however, it may not be what you want?).

 

TheoC_2-1634510482923.png

Anyway, hope one or the other help 🙂

 

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thanks @TheoC  for the explanation. 

Thats very helpful. 

 

Its closer to what I want. There are blanks at each level where the parent is the child. Is it possible to get rid of the blanks in the slicer? that would be best if possible. 

I have seen a hierarchy slicer visual which can control the blanks but its not performant. 

@PBIfanatic, there are a few ways to achieve this:

1. I believe the best way is through the use of Power Query being the second example I provided. 

2. You can untick "blanks" from the Filter pane of the visual when you click on "Child_2" field.

3. Finally, when you add "values" to the Matrix visual, you can use the Filter pane on the visual, click on the values, and then use "Basic Filtering" to untick 'blank'.

 

Best of luck! 🙂

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

thanks @TheoC 

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.