Nikhil
Nikhil

Reputation: 43

How to do Tableau Double Aggregation

Hi i am having a hard time figuring out how i can do a double aggregation in tableau. So, i have the initial data in this form

User Mar Feb Jan
A     X   Y   Y
B     Y   Y   Z
C     X   X   Z

X,Y,Z are state of the users A, B,C in any particular month Now i used a LOOKUP(ATTR(state),1) function see change in states of users from previous month to current month. For eg.

Y(Feb) -> X(March) = Pos
Z(Jan) -> Y(Feb) = Neg
Y(Feb) -> Y(March) = NC

By such rules I transformed the data using Calculated Field to this form

User Mar  Feb
A    Pos  NC 
B    NC   Neg
C    NC   Neg

Now i want to count the number of Pos, Neg, And NC in a particular month, i am unable to use COUNT functions since i already have used an aggregation using Lookup. This can be done easily in Excel but in Tableau any help would be appreciated.

Upvotes: 0

Views: 507

Answers (1)

Alex Blakemore
Alex Blakemore

Reputation: 11921

You can write a nested table calc using the window_count() function.

It is easier to write and test 2 separate table calc fields, one of which invokes the other, than to put everything in one. The addressing and partitioning can differ between the two.

Upvotes: 0

Related Questions