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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Changing Chart Colors with Filter Selections

Hi everyone,

 

I need some help with a simple "top 20" chart that shows top 20 zip codes by spend. These zip codes all fall under four "channels". I would like for the chart to change colors based on which channel is selected as a filter. I unfortunetly cannot post my data but I can provide pictures of the graph if needed. Thanks in advance!

1 ACCEPTED SOLUTION

@Anonymous OK, I think I understand a little better. Perhaps try a measure like below. In theory you can then tie rules to each value and corresponding color. You could also potentially use the ISFILTERED function here. Really difficult to say without knowing exactly what is going on. 

Measure Color Flag =
  IF(
    HASONEVALUE('Table',[channel]),
    SWITCH([channel],
      "display",1,
      "audio",2,
      "video",3,
      "social",4,
      0
    ), 0
  )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@Greg_Deckler Thank you Greg! I was able to combine your recomendation with the isfiltered function to get this: 

color =
IF (
    ISFILTERED ( channel[channel] )
        && VALUES ( channel[channel] ) = "Audio",1,
    IF (
        ISFILTERED ( channel[channel] )
            && VALUES ( channel[channel] ) = "Display",2,
 IF (
        ISFILTERED ( channel[channel] )
            && VALUES (  channel[channel] ) = "Paid Social",3,  
 IF (
        ISFILTERED ( channel[channel] )
                   && VALUES ( channel[channel] ) = "Video",4,0
    ))))

 

@Anonymous One last thing, you could make that a little cleaner using a SWITCH(TRUE(),...) statement. Just use your true/false parts of your IF statements. Glad it helped you get there!



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@Anonymous Should be able to do this with some fancy conditional formatting but hard to tell you what that would be exactly without sample data. Here's a thought. Make up some zip codes. Make up some channels. Make up some values. Post it as text. It doesn't need to be your data, just any data that can reasoanbly recreate the situation. Use Plum, Apple, Grape for your channels for example.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler thank you for your response! My data looks a little like this 

mmendez3_0-1663613792557.png

There are some other columns but for this situation I dont think they are relevant. Every row is the spend for a specific zip or "exchange" and the channel. There are 4 channels: display, audio, social, and video. I have a bar graph with spend on the y axis sorted from highest spend to lowest spend with those zips as the x axis. When I filter out to a specific channel I would like the color to change and match the rest of the dashboard (other graphs where channel is broken out by color as the legend). Any advice would help! I havent had much luck finding a similair situation online

 

@Anonymous OK, I think I understand a little better. Perhaps try a measure like below. In theory you can then tie rules to each value and corresponding color. You could also potentially use the ISFILTERED function here. Really difficult to say without knowing exactly what is going on. 

Measure Color Flag =
  IF(
    HASONEVALUE('Table',[channel]),
    SWITCH([channel],
      "display",1,
      "audio",2,
      "video",3,
      "social",4,
      0
    ), 0
  )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.