Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

I have two tables, users and purchases. They are inner-joined in the Data Source on a user_id.

For simplicity's sake let's assume that users only have the user_id field. purchases are made up of user_id, amount and category.

Now, I want to create a calculated field for the users table that will resolve to a boolean indicating whether a user had spent at least 200 on purchases with a category of "chair".

In a Pseudo-code/Tableau-langue hybrid, this is what I am looking to achieve:

IF TOTAL(SUM([amount] WHERE category="chair")) >= 200 THEN TRUE ELSE FALSE END

1 Answer

0 votes
by (47.2k points)
  • In the data pane sidebar, right-click on the user field and create a set based on the User field, defined by the condition

sum(if category=‘chair’ then [amount] end) > = 200

  • You can use the set as a filter, as a list of users, or as a Boolean function in a calculation

Related questions

Browse Categories

...