cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Z7-852
Helper I
Helper I

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.

1 ACCEPTED SOLUTION

@Z7-852

 

Your scenario is still confusing me. Maybe you're looking for something as below?

 


Capture.PNG

  1. Unpivot the table.
  2. Split the Product column by dot.
  3. 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")

Capture.PNG

Check more details in a

View solution in original post

29 REPLIES 29
preve05
Frequent 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.

I too have same issue, we need to change the legend name based on the data loads. It should bind it to column data.

This is the Idea. Vote for it!!

preve05
Frequent 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.

satbirminhas
Advocate I
Advocate I

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.

 

  1. Click your chart, and click the small triange next to the measure name on fields tab. 
  2. Click the rename button and type the new Label that you want to show on the chart.
  3. Legend label is automatically updated with the new label value.

I hope this helps!!

 

Step 1Step 1

 

Step 2Step 2

 

Step 3Step 3

 

Best Regards,

Satbir Minhas

Thank you! I wanted to know how to rename the legend and you covered it for me

Thank you!  Your answer was simple and to the point.  🙂

Thanks @satbirminhas. This is the solution!!

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.

deepvibha
Advocate II
Advocate 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.

Untitled.png

Can that be achieved?

 

Thanks.

Anonymous
Not 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.

Hi - You can rename the legends from the fields menuCapture.PNG

 

@AdamBuckley Thank you. This was introduced in one of the updates. Thank you anyways.

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

Thanks @edejes2,

 

I think I was not very clear in my question... here it is again - in a screenshot format:

Untitled.png

 

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

 

If you right click the measure you can re-name the measure, that will reflect in your legend. Likewise, you can add a custom legend accessing the setting of the visualization. 

I am not clear when you said  that  " Without remaining the measures" you don't want the measure that you apply?.

 

Best regards,

Global & Virtual Power BI User Group

 

 

 

 

 

 

Anonymous
Not applicable

I'm not sure why there is so much confusion around this question. I too am trying to accomplish what a few others are in this thread.

 

Simply, when you display a legend in a bar chart for example, the legend uses the name of the measures or columns. We wish to change the display name of the measures/columns in the Legend on the chart without renaming the actual measure/column. Power BI provides an option to give the Legend a title, but can you add a function so that we can change the display name for the measure/column? 

Hi, I am new to using Power BI. 

I was trying to solve exactly the same issue, but couldn't find the solution here.

 

What I did was - create a table containing two columns:

 

Col1: the legend types/names that you are trying to change on your report visual - use this column as an ID to create relationship with the current table.

Col2: The names/titles you would like to be displayed on your visual

 

Put your 2 original tables in the Axis, and add the new table we just created in the Axis as well - you now have 3 tables in the Axis.

 

Put the new table we just created into Legend. Hope it works for you too!

Thanks Iyasolis. I will give it a try and respond.

Hi

I have a demand to show the last 3 years gross profit distribution per product.

for this i chose clustred column visualization.

 

for this i created 3 measures:

Gross Profit 2 years ago 

Gross Profit Last Year

Gross Profit

 

All are based on a ParallelPeriod calculation.

 

I get the desired results, but the data legend takes the name of the measure automatically.

The year where the data presentation begines is deterimned by a slicer as shown here:

 

Example of my cluster column visual

 

 

 

Since these measures show the gross profit dynamically at the selected year,as well as  1 and 2 years prior to that year the legend shown for these measures is the name of the meaure (i.e. Gross Profit)

 

Now as each of these meaures represesnts data from a single year only, i would like the legend to take dynamic naming according to the year i calculates.

so if i am inspecing 2016, then i want to see at teh legend:

 

Gross Profit 2 years ago -->2014

Gross Profit Last Year --> 2015

Gross Profit --> 2016

 

can this be achieved?

 

Thank you,

Tal

 

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.