cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

How to change color bars as you pass a target ?

Hello everyone!

I need your help with a problem I have. What happens is that I need the bar to change color to green if it passes a target or constant value, or to change to red if it doesn't already arrive. attached photo of my graph

the idea is that after the intermittent line that comes out on the x-axis, it is the color change.

I'd be very grateful if you could help me.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: How to change color bars as you pass a target ?

Hi @CLCastroEn 

 

I would use conditional formatting in this case with % TR values as a percentage above the limit.

 

Did I resolve your issue? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit

Hope it resolves your issue? Please consider accepting it as the solution to help the other members find it more quickly.


Appreciate your Kudos, Press the thumbs up button!!👍


Regards,
Pranit

View solution in original post

7 REPLIES 7
Highlighted
Super User VI
Super User VI

Re: How to change color bars as you pass a target ?

You can write a measure like this that returns a result-dependent color value you can use in conditional formatting for your bar color.

 

Bar Color = IF([MyMeasure] > 1000, "Green", "Blue")

 

Then highlight your visual and in the Format options for your visual, hit the fx next to bar color and choose the measure you created.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




Highlighted
Community Champion
Community Champion

Re: How to change color bars as you pass a target ?

Hi @CLCastroEn 

 

I would use conditional formatting in this case with % TR values as a percentage above the limit.

 

Did I resolve your issue? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit

Hope it resolves your issue? Please consider accepting it as the solution to help the other members find it more quickly.


Appreciate your Kudos, Press the thumbs up button!!👍


Regards,
Pranit

View solution in original post

Highlighted
Super User IX
Super User IX

Re: How to change color bars as you pass a target ?

@CLCastroEn , if you are not using legend and not using multiple measures. You can create a color measure and use conditional formating using "Field" Option.

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
/// Add more conditions
"red"
)

 

refer:https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Helper II
Helper II

Re: How to change color bars as a target passes?

I don't understand, where do I find the conditional formatting? in my formatting tool does not appear.

@pranit828

Highlighted
Helper II
Helper II

Re: How to change color bars as a target passes?

@mahoneypat hello! didn't work for me 😞 could you attach a screenshot of how to do it? Please

Highlighted
Super User I
Super User I

Re: How to change color bars as you pass a target ?

@CLCastroEn You could try this approach, which builds on a solution I did earlier.

 

Add a measure for each color you want:

 

[Measure Red] = if([Measure]<100,[Measure],blank())

[Measure Green] = if([Measure]>=100,[Measure],blank())

 

Now you put both of those measures in your bar chart, and then choose what color you want like you want each to be:

 

donutColors.JPG

 

I hvae a PBIX here, and while you don't need the whole solution, you can use the measures for each color idea for your question: https://github.com/DataZoe/PBIX/blob/master/DonutShape.pbix 

Highlighted
Super User VI
Super User VI

Re: How to change color bars as a target passes?

Highlight your bar chart, and then find the Data Colors section in the Format pane

mahoneypat_0-1597437453721.png

Click on the fx, and pick Field Value and then the Bar Color Measure.

mahoneypat_1-1597437486936.png

If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.

Regards,

Pat





Did I answer your question? Please mark my post as a solution! Kudos are also appreciated!

Proud to be a Super User!




Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors