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

How to create a custom legend

I'm looking to create a legend based on rules that I have set for a scatter plot. Since there appears to be no clear way of doing this dynamically, is there any way to simply create a picture with the preset colors next to the rules? My graph and rules are below.

 

Scatter Plot Rules.pngScatter Plot.png

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

 

By my tests, the suggestion of GauravSingh should be helpful.

 

You could create the calculated column with the formula below.

 

UNICHAR_LEGEND =
IF (
    'Table1'[value1] <= 0.75,
    UNICHAR ( 128215 ),
    IF (
        'Table1'[value1] > 0.75
            && 'Table1'[value1] <= 1,
        UNICHAR ( 128210 ),
        IF (
            'Table1'[value1] > 1
                && 'Table1'[value1] <= 1.25,
            UNICHAR ( 128213 ),
            IF ( 'Table1'[value1] > 1.25, UNICHAR ( 128216 ) )
        )
    )
)

Here is the output.

 

Capture.PNG

 

If you have solved your problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable


@v-piga-msft wrote:

Hi @Anonymous ,

 

By my tests, the suggestion of GauravSingh should be helpful.

 

You could create the calculated column with the formula below.

 

UNICHAR_LEGEND =
IF (
    'Table1'[value1] <= 0.75,
    UNICHAR ( 128215 ),
    IF (
        'Table1'[value1] > 0.75
            && 'Table1'[value1] <= 1,
        UNICHAR ( 128210 ),
        IF (
            'Table1'[value1] > 1
                && 'Table1'[value1] <= 1.25,
            UNICHAR ( 128213 ),
            IF ( 'Table1'[value1] > 1.25, UNICHAR ( 128216 ) )
        )
    )
)

Here is the output.

 

Capture.PNG

 

If you have solved your problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best  Regards,

Cherry


 

This legend is non-functional. The code works but I can't get the label next to the color. As you can see in the picture above, the color is next to another color, rather than the assocated number for that bin.

Anonymous
Not applicable

Hi,

 

Make a new column as following :

                                         UNICHAR_LEGEND = IF( 'COLUMN'[NAME] < 0.75, unichar(128215),

                                                                            IF('COLUMN'[NAME] > 0.75 && 'COLUMN'[NAME]< = 1, UNICHR(128210)), UNICHAR(128213)).

 

 

AND now use thsi column to create legend.

 

 

Hope this will help

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.