Forum Discussion
Custom name legend
I have data with following columns:
Product1.FaultA, Product1.FaultB, Product2.FaultA, Product2.FaultB etc.
I want to draw two pie charts (one for product 1 and one for 2) that tell how many faults of each type occures.
What I need help with is naming the legends for these charts. By default they say Product1.FaultA and so on. But this is long and confusing because there are only data from single product in this chart. I would like to rename legends without renaiming columns in data.
Your scenario is still confusing me. Maybe you're looking for something as below?
- Unpivot the table.
- Split the Product column by dot.
- Rename the column properly.
In report window, to avoid confusion, instead of individual pie charts, use one chart with slicer. Create a measure Product Indicator and show it in a Card visual.
Product Indicator = IF(ISFILTERED('Table'[Product]),LASTNONBLANK('Table'[Product],""),"all product")Check more details in a
30 Replies
- satbirminhasAdvocate II
Power BI seems to have a simple way of implementing this.
The first chart below shows the original labels that are populated based on the name of the measures. Follow the steps listed below to change the labels on your chart.
- Click your chart, and click the small triange next to the measure name on fields tab.
- Click the rename button and type the new Label that you want to show on the chart.
- Legend label is automatically updated with the new label value.
I hope this helps!!
Step 1
Step 2
Step 3
Best Regards,
Satbir Minhas
- TalAruetyAdvocate I
Hi Satbir, thanks for your reply.
What you suggest is well when the meaures are year specific.
In my case my measures are relative.
that is i have a measure for last yaer, twoyears ago etc.
so each time data is refreshed its calculated based on current time.
when i open my report in 2017, i want last year lable to be named 2016.
at 2018 however the label for the same meaure should be 2017, automatically.
Any way to implement that?
Thank you.
- vyahumaNew Member
Thanks satbirminhas. This is the solution!!
- AnonymousNot applicable
Thank you! Your answer was simple and to the point. 🙂
- deepvibhaAdvocate II
Hi,
I am looking for maybe, a similar solution.....
I have created certain measures like mSumPhaco, mSumSICS and mSumFreeCataract and have plotted it on clustered column chart. Obviously, name of the measures are appearing as legends. I wish to change the legends as per the image below. One way of doing so is ofcourse renaming the measures, but I do not want to do so.
Can that be achieved?
Thanks.
- AdamBuckleyFrequent Visitor
Hi - You can rename the legends from the fields menu
- deepvibhaAdvocate II
AdamBuckley Thank you. This was introduced in one of the updates. Thank you anyways.
- edejes2Advocate IV
Hello deepvibha,
We discussed your question during the "Forum Aid" event of our user group.
You can try adding a custom column with the following if Text.Contains([ColumnName], "A") then "A" else "B"
Best regards,
Global & Virtual Power BI User Group
- deepvibhaAdvocate II
Thanks edejes2,
I think I was not very clear in my question... here it is again - in a screenshot format:
Being "Measures", there are no columns to be renamed with an "If" statement.
If I have got you wrong... pl. let me know in details how to achieve it with your solution.
Thanks
- AnonymousNot applicable
Hi Did you solved this problem,because i am also stuck in the same promblem,want to update the legend name of pie chart.
- ankitpatiraCommunity Champion
Z7-852 For pie chart visual under paintbrush icon, you do have option to rename Legend or even turn it off. You can also rename column in your data set.
- Z7-852Helper I
Solution given by ankitpatira is not what I'am looking for.
From format you can give a title for legends. This is not what I need.
I need to rename variables without changing their names in the data set. If I chance names in data set I would have to columns both names "Fault A" and I wouldn't know which is for product 1 and which is for product 2.
- ankitpatiraCommunity ChampionZ7-852
So do you mean changing values of actual rows ? In that case you will have to do replace values via query editor to replace values of actual rows in column which will become legend in pie chart.
- NehaVageriyaAdvocate II
Hi, Did you find the solution for this problem ? As I am also stuck with the same.
Also the solution posted for this problem is incorrect and so this problem's status should be changed to "Not Solved"
- Z7-852Helper I
I used combination of unique queries with filters and visual level filters to archieve my goal.
- preve05Frequent Visitor
I too have a similar requirement for customizing the Legend labels. I am using a filter on a measure in a clustered bar chart and I cannot afford to change the column name because it is being used in other charts. This is an important UI requirement. Please provide fix for this.
- preve05Frequent Visitor
I too have a similar requirement for customizing the Legend labels. I am using a filter on a measure in a clustered bar chart and I cannot afford to change the column name because it is being used in other charts. This is an important UI requirement. Please provide fix for this.
- akshaybogarFrequent Visitor
I too have same issue, we need to change the legend name based on the data loads. It should bind it to column data.
- FedeMosqueraFrequent Visitor
Hi all, I came across this video, which showed me how to make the measure names change dinamically and solved the issue.