Forum Discussion

Ariel_1's avatar
Ariel_1
Regular Visitor
2 years ago
Solved

Shape Map with Custom Legend

Hello, I am a new user.  I want to develop the shape map with custom legend.  The legend is by range and kindly find the example of my idea below: Table 1 (Sample) Area1 Country Item Custome...
  • rajendraongole1's avatar
    2 years ago

    Hi Ariel_1 - Legend wise visual colors change automatically conditional formatting will not work out but

    I have created supporting tables for range of colors mentioned as below. we will use lookupvalue function as below

    First create a calculated table with customerRange:

     

    CustomerRange = DATATABLE(
    "Range", STRING,
    "Color", STRING,
    {
    {"1 - 5", "Red"},
    {"5 - 6", "Green"},
    {"6 - 10", "Yellow"},
    {"Greater than 10", "Orange"}
    }
    )

     

    create another calculated table with for amount

     

    AmountRange = DATATABLE(
    "Range", STRING,
    "Color", STRING,
    {
    {"Less than 1K", "Color1"},
    {"1K - 10K", "Color2"},
    {"10K - 100K", "Color3"},
    {"100K - 1000K", "Color4"},
    {"Greater than 1000K", "Color5"}
    }
    )

     

    Hope you already created total amount and count of customers measures at your end to pass the swith condition based on both metrics as below:

     

    CustomerCountRange =
    SWITCH(
    TRUE(),
    [CustomerCount] >= 1 && [CustomerCount] <= 5, "1 - 5",
    [CustomerCount] > 5 && [CustomerCount] <= 6, "5 - 6",
    [CustomerCount] > 6 && [CustomerCount] <= 10, "6 - 10",
    [CustomerCount] > 10, "Greater than 10",
    BLANK()
    )

     

     

    create another measure for amount range like customerRange

     

    AmountRange =
    SWITCH(
    TRUE(),
    [TotalAmount] < 1000, "Less than 1K",
    [TotalAmount] >= 1000 && [TotalAmount] < 10000, "1K - 10K",
    [TotalAmount] >= 10000 && [TotalAmount] < 100000, "10K - 100K",
    [TotalAmount] >= 100000 && [TotalAmount] < 1000000, "100K - 1000K",
    [TotalAmount] >= 1000000, "Greater than 1000K",
    BLANK()
    )

     

    create a customer Count Color Measure and similar amount range measure

    CustomerCountColor =
    LOOKUPVALUE(CustomerRange[Color], CustomerRange[Range], [CustomerCountRange])

     

     

    i have taken country with states names ,, pass the color 

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!