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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sravansadu
Regular Visitor

Color code a legend based on a measure in scatter plot

  

Hi,

 

I am creating a scatter chart for different hierarchy level. For each individual person in the lower level of the hierarchy, I created a column that categorizes him under particular range and I colored the range using the legend and data colors option(as below screenshot). This works well for the individual people in the lower level. However, when I drill it up the hierarchy, the range doesn't work well and the color coding fails. I thought that's because it is a categorical value (text format), which is remaining static even when you drill it up. Suppose if the supervisor has two people with different categories in the lower level it shows the supervisor as two people in the higher level hierarchy visualization. 

So, I tried assigning numeric values (whole numbers) for the range to see if it helps. But that also failed because the column placed in the legend to color code cannot function as an aggregate when you drill it up.

Later, I created a measure, which is dynamically calculated for any person in any hierarchy level. But it seems like the measure cannot be used in the legend. I know there is color saturation option(limited to 3 colors: maximum, minimum, and center) but I cannot use all the colors that I want as in the screenshot. Could you please help me with this issue? Thank you for your inputs in advance!

 

Below are examples of the column with ranges that I am creating

 

Column that I am creating through dax is category_ColumnN = IF(tableA[total_alpha] <= 0.05, "<= 5%",

IF(tableA[total_alpha] <= 0.10, "> 5% - 10%",

IF(tableA[total_alpha]<= 0.20,"> 10% - 20%",

IF(tableA[total_alpha] <= 0.30, "> 20% - 30%", "> 30%"))))

 

 

But it doesn't work well when I drill it up the hierarchy. 

 

 

 Capture.jpeg

             

 

 

 

Also, tried to create category with a numerical value

 category_ColumnN = IF(tableA[total_alpha] <= 0.05, 1,

IF(tableA[total_alpha] <= 0.10, 2,

IF(tableA[total_alpha]<= 0.20,3,

IF(tableA[total_alpha] <= 0.30, 3,5)))) 

 

Even this didn't work when I drill it up. Reason I understood is that the legend doesn't have aggregate functionality. So, created measure that calculates the alpha for anyone in the hierarchy. Can I use the measure "alpha" in legend by any chance? I don't want to use it under color saturation. Thank you for your inputs in advance!

 

 

 

 

 

 

 

3 REPLIES 3
UsableData
New Member

I am also trying to use the bucketed/binned/grouped measure values as legends in my scatter chart. This is doable in Tableau as it does not seem to care if the legend is a result of a measure value calculation. The scatter chart visual only allows non-measure columns.
v-micsh-msft
Employee
Employee

Hi sravansadu,

 

I assume this should be caused by the hierarchy. If you use measure, data would change as the filter (hierarchy) changes. And the data range might go wrong.

Would it be available for you to share the data model (or a data sample) here? I will make some tests based on your data model.

In addition, I saw your Power BI desktop is still in the old version, please download the most updated one:

Power BI desktop

Regards

 

Yes, you are right that the filter works well with the measure. However I am not sure about the range how to create on basis of measure. I created range using column but when the filter is applied(even when I use filter to select particular dates) then the color legend doesn't work well.

 

Unfortunately, I can't share the data model or sample. I will try to replicate similar data set for you if possible by tomorrow.

 

I will download the latest version but I don't think this issue is because of the version. Is there anyway that I can use some function in the legend using a column. For example, I used sum function in the column that I gave under x-axis and y-axis and also I gave average function for size. These all are working fine but I couldn't find a way to create function in legend for the column that I am using under it. Please let me know if there is anyway to do that. Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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