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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Niki
Helper III
Helper III

Multiple values in line chart with legend

Hi,

 

I run into the problem of not being able to put multiple values in a line chart and also have a legend. It seems to be it's either a legend or multple values. I think it is really logic to want this, in my case I have column with scores in my dataset, but also a column with the norm/standard. So I want to show both values (which I calculate in a measure), the score in a solid line and the norm in a dashed line in the same color as the score that in belongs to. I would like the legend to show all of those lines and dashed lines, because users must be abl to compare scores to the norm but also to compare scores with eachother.

 

I see some workaround by creating separate measures for every line, but it is not working for me.

Making all the scores and norm into separate measures isn't an option, for 2 reasons: 

1. The categories (which would be the legend) are dynamic, so I need the report to just pick up on every catergory that is in there. 2. When I make certain selections, the legend will keep showing all the measures I make, even though they are not in the selected data, which makes the visual very ugly, full and unclear.

 

Ik think PowerBI still does not have a solution for this or?? Is there any custom visual that can help me out, one that is  very well supported please, because I don't want the report to break on an PBI-update. Hope someone can help me on this! Kind regards, Niki

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

This is a lot of info to put on one single graph. I think you could do it by creating a custom column to use in legend - the column would need to be in a format such as: CategoryA - Norm, CategoryA - Score, CategoryB - Norm, CategoryB - Score, etc
Then you put the measure in values and the new column as your legend. Your measure would need updating with a switch to check if the type is Norm or Score and then use the correct calculation.


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

View solution in original post

4 REPLIES 4
Niki
Helper III
Helper III

@AllisonKennedy  your post gave me inspiration to do some magic on the data and I think it worked!

Still need to do some datachecks, but for now it looks good! Thanks

Greg_Deckler
Community Champion
Community Champion

@Niki - Could you present an image of what you are thinking? I am having trouble visualizing it. There are options for having things dynamic, like here: https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-EVERYTHING-measures-axis-legend-titl...

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Niki , Not very clear on the need.

Dynamic legend is a challenge. There is some solution here. You can refer

https://prathy.com/2018/12/dynamic-legend-in-power-bi-visual-linechart/

 

Not sure that can help much.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Super User
Super User

This is a lot of info to put on one single graph. I think you could do it by creating a custom column to use in legend - the column would need to be in a format such as: CategoryA - Norm, CategoryA - Score, CategoryB - Norm, CategoryB - Score, etc
Then you put the measure in values and the new column as your legend. Your measure would need updating with a switch to check if the type is Norm or Score and then use the correct calculation.


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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors