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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
korina
Helper I
Helper I

100% Stacked Line Chart responding to slicers/filters

Hello everyone,

 

I am trying to create a 100% stacked line chart, but I need the calculations to respond to some slicers I have in place. Everything works perfectly when I change the graph type to 100% stacked column chart, so there must be a way to convert it to a line chart, but I am not experienced with DAX, and not sure how I can achieve that.

 

Here is the link to all my work:

https://www.dropbox.com/s/d7mefa9qrvr5wh2/100%25%20Stacked%20Line%20Graph.pbix?dl=0

 

Please also see some pictures below, for reference:

 

This is the graph that I have managed to create, and works perfectly without filters.

Capture.PNG

 

 

This is what happens when I choose a filter.

Capture1.PNG

 

This is the desirable result when I choose a filter - except it is a column chart, instead of a line chart.

Capture2.PNG

 

Any help will be very much appreciated 🙂

Korina

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

I've had a shot at it.

 

Please test against your own data

Employees100% = VAR _gender = SELECTEDVALUE(Headcount[Gender])
VAR _thisGenderVal = [Employees%]
VAR _otherGenderVal = CALCULATE([Employees%], Headcount[Gender] <> _gender)
RETURN
    DIVIDE(_thisGenderVal , (_thisGenderVal + _otherGenderVal) )

View solution in original post

2 REPLIES 2
korina
Helper I
Helper I

Thank you so much @HotChilli, it seems to be working perfectly 🙂

HotChilli
Super User
Super User

I've had a shot at it.

 

Please test against your own data

Employees100% = VAR _gender = SELECTEDVALUE(Headcount[Gender])
VAR _thisGenderVal = [Employees%]
VAR _otherGenderVal = CALCULATE([Employees%], Headcount[Gender] <> _gender)
RETURN
    DIVIDE(_thisGenderVal , (_thisGenderVal + _otherGenderVal) )

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

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

Jan NL Carousel

Fabric Community Update - January 2025

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