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.
(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.
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.
(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!