error on aggregate and non aggregate values

0 votes

While creating the following calculated field I am getting an error on aggregate and non aggregate values.

 if (COUNTD([Category])=1 then [Sub-Category]
else [Category] END

Note: I am using the super store data-set. So when a user selects a filter in the quick filter for category, I was expecting that the countd becomes one and shows sub category as rows in the table instead of category.

Apr 17, 2018 in Tableau by ghost
• 1,790 points
62 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Create a calculated field that outputs a column to be used a the filter to select the sheet.

  1. Create the following calculated field:
{ FIXED : if COUNTD([Category]) = 1 
then 'Sub Category' elseif countd([Category]) > 1
then 'Category' END}
  1. Create two worksheets first one broken down by category and the next by sub category.
  2. Add the Category filter to both worksheets and set to a context filter.
  3. Drag the calculated field column to the filter pane. For the Category worksheet select the filter to Category and do the same for the sub category worksheet.
  4. Finally drag both the worksheets into a dashboard and format them appropriately.
answered Apr 17, 2018 by Atul
• 5,470 points

Related Questions In Tableau

0 votes
1 answer

Error - Aggregate and on-aggregate cannot be combined.

Hi Ritu, This happens when you are comparing ...READ MORE

answered 3 hours ago in Tableau by anonymous
• 13,860 points
6 views
0 votes
1 answer

how to get the count of non zero values in a row

In first part you should solve the ...READ MORE

answered Apr 4, 2018 in Tableau by Atul
• 10,200 points
74 views
0 votes
1 answer

Rank measure values and show percentage of measures in Tableau

Hi Sindhu, 1. First create a table with ...READ MORE

answered Mar 8 in Tableau by CHERUKURI
• 13,860 points
38 views
0 votes
1 answer

How to aggregate and count the occurrence of TRUE and FALSE?

Hi, you can do any of below ...READ MORE

answered Mar 12 in Tableau by CHERUKURI
• 13,860 points
49 views
0 votes
1 answer

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,200 points
916 views
+1 vote
1 answer
0 votes
1 answer

Calculated filed with if-then

Below is the required code:  IF (NOT ISNULL([test2])) ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,200 points
36 views
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to calculate profit when cost and revenue are in same column?

You can create the following calculated fields: Profit: SUM(IIF([account_category] ...READ MORE

answered Apr 10, 2018 in Tableau by Atul
• 5,470 points
45 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.