Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to Assign Hex Code Based On Measure Value

Hello everyone,   I have a measure that I want to assign colours based on whether it's positive or negative.    Colour1 = VAR MySelection = SELECTEDMEASURE() RETURN SWITCH( [Total Sales Varianc...
  • VahidDM's avatar
    4 years ago

    Hi Anonymous 

     

    Try this:

    Colour1 =
    SWITCH (
        TRUE (),
        [Total Sales Variance Percent] > 0, 1,
        [Total Sales Variance Percent] < 0, 2,
        BLANK ()
    )

    Then define color1=1-> #41AC4C and if color1=2 -> #E42925

    or use this:

    Colour1 =
    SWITCH (
        TRUE (),
        [Total Sales Variance Percent] > 0, #41AC4C,
        [Total Sales Variance Percent] < 0, #E42925,
        BLANK ()
    )

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/