cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
HNil
Frequent Visitor

Dynamic legend in stacked area chart

Hi,

 

I'm strugling to understand how to implement dynamic variables to my stacked area chart. I've tried looking at different solutions, but I can't comprehend how to apply it to my own data. 

 

My data table consist of the following table from Excel:

 

SectorYearCostsTech A reductionsTech B reductionsTech C reductionsTech D reductions
Farms2025500-15-10  
Farms2027515-35-50  
Fishing20251500  -60-100
Fishing20271525  -150-120

 

In my stacked area chart, I want to be able to have a slicer that toogles "Farms" or "Fishing". But if I select only "Farms" for instance, I only want the legends for Tech A and Tech B to be visible, since all the numbers from the two "Fishing"-related columns aren't present in the visual anyways (except for their legends, that are cluttering my visual).

 

In my stacked area chart, I have "Year" on the X-axis and "Costs" & "Tech A-D" on the Y-axis.

 

Any help is greatly appreciated. Apologies if this has been asked before, but I couldn't get other solutions to work for me.

 

Best regards

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You do that by bringing your source data into a usable format. The process is called unpivoting.

 

From 

lbendlin_0-1695501050905.png

to 

lbendlin_1-1695501145091.png

From there your legend issues resolve themselves.

View solution in original post

2 REPLIES 2
HNil
Frequent Visitor

Thanks Ibendin, for making that clear to me.

 

The solution was indeed to unpivot the cost-column and the technology columns.

lbendlin
Super User
Super User

You do that by bringing your source data into a usable format. The process is called unpivoting.

 

From 

lbendlin_0-1695501050905.png

to 

lbendlin_1-1695501145091.png

From there your legend issues resolve themselves.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors