1

I have a database of users and each user record has "User ID" and "Group". After filtering out a chunk of the records, I'd like to sum the number of users within each group. Currently I am doing that with the calculation:

{FIXED[Group]:SUM([Number of Records])}

The problem here is this calculation appears to ignore any records that I've filtered out and just gives a total count per group from all of the unfiltered data.

Is there a quick way to sum the number of visible users in each group after applying a filter?

Dylan Stark
  • 2,325
  • 17
  • 24

1 Answers1

4

The easiest way of solving this would be to take advantage of the order of operations in Tableau.

The issue you are having at the moment is the LOD calculation is performed prior to a dimension filter.

If you want to calculate a field at a different level of detail then the view than a LOD is still the way to go. All you need to do is force tableau to apply the filters before calculating the fixed calculation.

In order to do this change your filters to a context filter. This is done by right clicking on the filter and selecting "Add to context. You will see the filter change from blue to grey.

Your calculated field should now be sensitive to any context filters.

Find out more here

smb
  • 653
  • 4
  • 13