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

100% Stacked Column Chart as Line Chart

Hello,

 

I need help. I am trying to create a 100% Stacked Line Chart.

Essentially, I want a 100% Stacked Column Chart but with as a Line Chart. The legend also needs to be interchangeable as I will be creating multiple visualisations.

Example Data:

Axis is Year

Legend is Category

Value is Unknown Measure?

 

Any information would be beneficial. Thanks

6 REPLIES 6
Anonymous
Not applicable

Thanks for the quick reply.

I want to see the category % on a line chart

 

Axis = Year

Legend = Category (Red Yellow Green)

 

YearRedYellowGreenTotal
20162 = 50%1 = 25%1= 25%100%
20171= 25%2 = 50%1= 25%100%
20181= 33%1 = 33%1= 33%100%

 

But if I slice by category, I want to see.

 

YearRedYellowTotal
20162 = 66%1 = 33%100%
20171= 33%2 = 66%100%
20181= 50%1 = 50%100%

 

I also need to be able to change the legend to something else, so no hard coding of the categories (e.g. "Red").

@Anonymous try following measures and put % measure on line chart, with Year on x - axis and category on Legend

 

Sum = SUM ( Line[Value] )

Sum Category = CALCULATE( [Sum], ALLSELECTED(  Line[Category] ) )

% = DIVIDE ( [Sum], [Sum Category] )

In expression, change table and column name as per your data model. and change data type of % measure to %.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Ah yes, thats an easy way, but is there any way to use the Line(Category) as the legend, so I can drop in different categories using the same measure? It's this part that I cannot figure out.

@Anonymous not fully sure about your question, do you want different value x-axis and keep category on legend, is this what you are asking?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

No, I mean from this:

Sum = SUM ( Line[Value] )

Sum Category = CALCULATE( [Sum], ALLSELECTED(  Line[Category] ) )

% = DIVIDE ( [Sum], [Sum Category] )

To this:

Sum = SUM ( Line[Value] )

Sum Category = CALCULATE( [Sum], ALLSELECTED(  Whatever is in the legend ) )

% = DIVIDE ( [Sum], [Sum Category] )

Essentially I need the legend to be dynamic. The way I see it, the Axis and Value need to be the same but I need to be able to change the legend (category). As you can do in the 100% Stacked Column Chart, by just dragging in another column.

parry2k
Super User
Super User

@Anonymous can you provide more details. It is not very clear what you are looking for. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.