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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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