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
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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors