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
Anonymous
Not applicable

Stacked Area Chart with Multiple Columns as the "Legend/Values"

I've done a bunch of Google searches and can't seem to find a question that mirrors what I'm trying to do (if it's even possible).

 

I have a bunch of inventory snapshots that are stitched together in the folder data source with many more to come.  Each file has a column with the date of the export repeated through each line which typically serves as the X-axis so I can trend each data report.

 

Where I got stuck is how the inventory reports I'm dealing with come out and the data I need to represent.  Within the report there are six different columns that each represent different inventory segments (things like in-transit between warehouses, off-quality goods, etc...).  The problems comes because they can have inventory in multiple buckets, so I can't just do some logic to look at those columns and say "Product A is in transit".  Product A may have some inventory that is being put into a shipment, some that's off-quality, some that's in-transit, etc...  So bottomline, the columns need to remain and I can't just add them all together and say "this is the total inventory for Product A".  I'd like to trend this so we can see as a whole how our good inventory is trending, how our inventory being put into shipments is trending, etc...  I thought the perfect tool for that would be a stacked area chart, but that wants one dimension for the magnitude of the bar and one dimension to bucket the row into each category of the legend.  What I'd like to do is basically have each column be an element of the legend with the value of the column being a component of the magnitude of that bar.

 

I hope I conveyed what I'm trying to do.


Thank you for any help!

1 REPLY 1
AllisonKennedy
Super User
Super User

@Anonymous  I think your problem is that your data is in report format when you get it. You need to Unpivot, and can do this in Power Query. Mynda has a great post on why your data should be unpivoted: https://www.myonlinetraininghub.com/excel-tabular-data-format 

 

Click 'Transform Data' to open Power Query.

Select the columns that you want in the Legend (we call these 'Attributes'). So in your case, the 6 columns 'In Transit', etc. 

In the Transform tab > Unpivot Only Selected Columns

 

You'll get an 'Attribute' and 'Value' column, you can rename these if you want, but put the Attribute column in the Legend of your stacked area chart, and voila!


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.