Forum Discussion

johnny149628's avatar
johnny149628
New Member
3 years ago

Reset Color Order for Visible Lines

I am working with a line plot, where for instance I would like to plot the earnings of an employee. We have many stores and many employees, so I filter down by store name and then employee. The issue is, if I select a single employee (Store Number N, Employee X), it will choose a different color depending on which this is.

 

Instead, I would like the first employee shown to be blue, the second to be red, etc. Basically, reset the color order based on the series actually being depicted.

 

Is there way to accomplish this?

2 Replies

  • v-yadongf-msft's avatar
    v-yadongf-msft
    Community Support

    Hi johnny149628 ,

     

    I think conditional formatting is more suitable for you.

     

    This is my test table:

     

    Create a new column:

    Color = 
    var employee_rank = RANKX(FILTER('Table','Table'[Store number] = EARLIER('Table'[Store number])),'Table'[Employee],,ASC,Dense)
    return
    SWITCH(
        TRUE(),
        employee_rank = 1,"deep sky blue",
        employee_rank = 2,"hot pink",
        employee_rank = 3,"lightgreen"
    )

     

    Create a table visual and right click, select conditional formatting - background color.

     

    Field value - Color

     

    You will get a table like this:

     

     

    The result you want after filtering:

     

    Best regards,

    Yadong Fang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • I don't believe this works for a couple reasons. 1) conditional formatting is not available for line plots 2)once I add a legend (for a column chart) conditional formatting is no longer available.

     

    The legend applies the colors currently, so maybe I could re-word the question:

     

    If I am setting distinct lines by legend, is there a way to order the colors based on the order in the legend. For example, if my legend has 5 entries, regardless of what the store and employee are, make the first entry colored blue, the second colored red, etc.