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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
M_Capps
Regular Visitor

Do I need to split a row to graph unique values

Good day,

 

I have the following table that tracks orders and the category(ies) that the items belong in:

 

Order Number Item NumberAgency County Category 1Category 2Category 3Category 4Category 5Category 6Category 7Category 8Category 9Category 10Category 11Category 12
201905378 2-1ACME, Inc. New Hanover    Y     Y  
201905378 2-1ACME, Inc. New Hanover        Y    
201905378 2-2ACME, Inc. New Hanover    Y     Y  
201917154 2JustAnotherPlace Craven    Y        
201917154 3JustAnotherPlace Craven    Y        
202000456 1Knowhere Craven Y     Y     
202000456 1Knowhere Craven Y           
202002107 1Places Pasquotank       Y  Y Y
202002345 1NothingKnew Jones  Y Y   Y    
202002818 1AlwaysOld Pamlico Y  Y        

 

On my visualization, I need this table as-is but also need a Stacked Bar Chart that graphs the data by Agency and Category:

 

M_Capps_0-1691675789802.png

 

When an item has only one category, it graphs correctly. However, when an order has multiple categories for the same item (Order Number 202002345) the graph only picks up the last indicated category. Order Number 202002345 only counts Category 8 and ignores Category 2 and Category 4.

 

The actual table is roughly 25,000 rows so manually splitting isn't feasible.  Is there a way to dynamically code it where I actually can catch multiple categories for the same Order Number and Item.

 

Thanks

 

 

 

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @M_Capps 

To work effectively with the data in the table, it is necessary to unpivot it.
Don't worry 25K rows is a very small database for a power bi engine.

The steps for unpivot on power query:
1. Select all columns except of categories

Ritaf1983_0-1691723922291.png

 

2. Use the option of "unpivot other columns"

Ritaf1983_1-1691724057306.png

3. close and apply.

4. Create the graph:

Ritaf1983_2-1691724454727.png

 

Link to the sample file 

Please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Ritaf1983
Super User
Super User

Hi @M_Capps 

To work effectively with the data in the table, it is necessary to unpivot it.
Don't worry 25K rows is a very small database for a power bi engine.

The steps for unpivot on power query:
1. Select all columns except of categories

Ritaf1983_0-1691723922291.png

 

2. Use the option of "unpivot other columns"

Ritaf1983_1-1691724057306.png

3. close and apply.

4. Create the graph:

Ritaf1983_2-1691724454727.png

 

Link to the sample file 

Please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

This did exactly what I was needing it to do. Thanks @Ritaf1983 

Glad to help 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.