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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Super User
Super User

@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...

 


@ 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!:
Mastering Power BI 2nd Edition

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.

 

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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