Understanding the Attribute Function in Tableau
top of page
  • Bernard K

Understanding the Attribute Function in Tableau


Attribute function in tableau

By definition, ATTR () function aka Attribute function, returns the value of the given expression if it only has a single value for all rows in the group, otherwise it displays an asterisk (*). Note, NULL values are ignored.

To explain this, let’s take a look at this sample data.

sample data

(The above sample customer data shows, the name of each customer, products purchased, and amount spend)

Using the above dataset, I have created this view showing Amount Spend on Products.

Now, lets apply the attribute function to the Customer Name dimension.

simple attribute calculation

Adding the above calculation to the Rows shelf, we’ve.

(From the above view, the Attribute function returns (*) for the products purchased by more that one customer, while returning the Customer Name for the products purchase by one customer)

See below, when I replace the Attribute calculation which the dimension Customer Name.

You can confirm that - Products namely Chairs, Copiers, and Tables were indeed purchased by more than one customer.

In summary, you can say the Attribute function returns an asterisk (*) for categories (Products) with more than one possible value (Customers), while returning Customer Name for products with only one possible value.

This is how Tableau computes the Attribute function.

how tableau computes attribute function

(Which returns (*) whenever the MAX (Value) is not equal to the MIN(Value), while returning the MIN(Value) or the MAX(Value) whenever the two are equal).

Conclusion

If this post was helpful and you would like to receive more of these Tableau tips and tricks, kindly subscribe to our mailing list below.

If you like the work we do and would like to work with us, drop us an email on our Contacts page and we’ll reach out!

Thank you for reading!

Blog.png
Black & white.jpg

About Me

More About the Author

Bernard K

Analytics Consultant | 3X Tableau Certified

Bernard is a data analytics consultant helping businesses reveal the true power of their data and bring clarity to their reporting dashboards. He loves building things and sharing knowledge on how to build dashboards that drive better outcomes.

Let’s discuss your data challenges! Let’s work together!

bottom of page