- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Legend in Line chart with two axis
Hi,
I am using a line chart visual, the underlying data is using dax table.
In chart 'Value' field I have inserted a column with 100k range and 'Secondary value' field has data in percentage format.
Both these values are again a dax measure.
As you are aware, PowerBI doesnt allow me to add Legend field and it populates legend automatically in the visual.
In my case, the legend doesnt change when I use different slicers to see particular fields in 'Value'.
Does any one know, if I can add the legend using dax or through any other way so that my legend works properly?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @amitbisht51
The Solution to go around this is by bookmarks and selection buttons or images.
1- Create Identical chart but for %
2- switch the two views of charts by using bookmarks and buttons. Follow the link below to understand bookmarks and how to use them.
https://youtu.be/xCMqWEvSkAs
Good Luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @amitbisht51 ,
A great Super User ( @parry2k ) made a blog post about that dinamic change of legend check it on the link below:
https://perytus.com/2021/02/04/improve-ux-show-year-in-legend-when-using-time-intelligence-measures/
Regards
Miguel Félix
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
Check out my blog: Power BI em Português- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @MFelix ,
I am able to create to legend using dax, but since I have values in secondary field also alongwith primary values, I am not able to add my legend.
Is it possible to add the legend in this case?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @amitbisht51 ,
If you use legend you cannot add the secondary values and vice-versa, in this case and since it's a line chart I would recommend the use of a disconnect table with the calculation details plus the secondary value.
For example if you need to have years and average of something you would need a similar table to this one:
Calculation
2018
2019
2020
2021
SecondaryValue
Then using a switch measure for each value.
If you need help to setup this can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.
Regards
Miguel Félix
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
Check out my blog: Power BI em Português- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @MFelix
I am facing a similar issue. Can you explain how to create a disconnected table with an example to solve this issue?
Thanks.

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
01-15-2025 02:44 AM | |||
10-03-2024 11:16 AM | |||
02-04-2025 06:08 AM | |||
02-10-2025 02:47 AM | |||
12-01-2024 01:15 AM |
User | Count |
---|---|
141 | |
115 | |
84 | |
63 | |
48 |