By: Eric Parker
Eric Parker lives in Seattle and has been teaching Tableau and Alteryx since 2014. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email.
Let me start by saying this, I’m not sure I fully endorse this approach but I wanted to write a blog post to demonstrate a concept. You’ll have to decide for yourself whether this is a good or bad idea for your audience.
I’ve gotten asked by multiple students if it’s possible to create a currency formatted field where the unit at the end of the number can be a K or M depending on the size of the value. Let’s imagine we are working with a chart like this.
The tricky thing about number formatting in Tableau is the default options only allow you to pick one format per field. That means you can pick K or M but not both.
The solution is to create two calculated fields, one for values over a million one for those under, and format them differently. Here’s what this can look like.
This first calculation is for values equal to or greater than $1M (possibly a little lower like $999,500 depending on your data and rounding).
This field should be formatted with a single decimal place and have a M unit added.
The next calculation is for values less than $1M.
This field can be formatted with K units and 0 decimal places.
Then both calculations can be added to Label on the Marks Card.
Finally, you can edit the layout of the fields in the Label section of the Marks Card so your end user can’t tell that two different fields are being used for labels.
If you take this approach, remember to clean up those tooltips!
Need help with your own customization? Reach out or book an office hour and we’ll help you get rolling!