Search

How to Format Positive and Negative Values in Tableau Using Color and Custom Formats


How do you format positive and negative values in tableau in this example I have sum of profit by state and region and I'm showing a color of red if it's negative and green if it's positive negatives have a negative symbol and positives do not have a symbol let's add a new sheet and see how to do this in tableau., start by dragging region and state to rows.I'm gonna drag profit to the abcs Now I want to format these negative and positive values by red and green let's write a calculation for that so create a calculated field it's going to be an if statement we'll call this color if sum of profit is greater than zero then green else if sum of profit is less than zero down red and let's click apply okay and let's drag that color field onto the view onto color. Doesn't default to red and green it defaulted to blue and orange you can change the green to green and red to red apply okay. The formatting was set by default but I can adjust it if I want if I click on the drop down on profit click format in the pane I want the numbers to be a little bit different first I want to click number custom and then click custom that's going to take the logic used to build that number and put it into this custom format field I want positive values to have a plus before them and negative values to have a negative before them there's a colon in between Click ok and now I have negative values at with a negative sign and positive value to the positive sign colored in red and green hope this helps

46 views0 comments