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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
M_Capps
New Member

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

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