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
Ahmaddaniyal
New Member

Product Category Hierarchy

I have data similar to the following tables containing category hierarchy and sales quantity by items.

Ahmaddaniyal_0-1650834777058.png

 

Ahmaddaniyal_1-1650835056065.png

I want to create a hierarchy based on the product category and filter the sales quantity table by it.

i.e

Category 

A

B

C

 

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Ahmaddaniyal ,

Here are the steps you can follow:

1. Enter Power query, select [Category hierarchy 1], [ Category hierarchy 2], [ Category hierarchy 3] - Unpivot Columns of Table.

vyangliumsft_0-1651047285173.png

2. Right-click the newly generated [Attribute] - Remove.

vyangliumsft_1-1651047285174.png

Result:

vyangliumsft_2-1651047285175.png

3. Check [Value] - Sort Ascending - uncheck its blank.

vyangliumsft_3-1651047285176.png

Result:

vyangliumsft_4-1651047285176.png

4. Home – Merge Queries -- Merge Queries as New.

vyangliumsft_5-1651047285177.png

vyangliumsft_6-1651047285178.png

5. Open the new table formed, click Expand next to Table2, and select [SalesPerson] and [SelesQuantity].

vyangliumsft_7-1651047285179.png

vyangliumsft_8-1651047285179.png

6. Result:

vyangliumsft_9-1651047285181.png

 

Best Regards,

Liu Yang

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

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @Ahmaddaniyal ,

Here are the steps you can follow:

1. Enter Power query, select [Category hierarchy 1], [ Category hierarchy 2], [ Category hierarchy 3] - Unpivot Columns of Table.

vyangliumsft_0-1651047285173.png

2. Right-click the newly generated [Attribute] - Remove.

vyangliumsft_1-1651047285174.png

Result:

vyangliumsft_2-1651047285175.png

3. Check [Value] - Sort Ascending - uncheck its blank.

vyangliumsft_3-1651047285176.png

Result:

vyangliumsft_4-1651047285176.png

4. Home – Merge Queries -- Merge Queries as New.

vyangliumsft_5-1651047285177.png

vyangliumsft_6-1651047285178.png

5. Open the new table formed, click Expand next to Table2, and select [SalesPerson] and [SelesQuantity].

vyangliumsft_7-1651047285179.png

vyangliumsft_8-1651047285179.png

6. Result:

vyangliumsft_9-1651047285181.png

 

Best Regards,

Liu Yang

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

Ahmaddaniyal
New Member

but it does not resolve my issue to filter by categories.

A

B

C

as mentioned in the dataset

amitchandak
Super User
Super User

@Ahmaddaniyal , Unpivot the category in the first table, that will all categories in row for the item, That will make analysis easy. But will create a many to many join

 

https://radacad.com/pivot-and-unpivot-with-power-bi

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.