1 Reply Latest reply on Apr 11, 2017 9:51 AM by Patrick Van Der Hyde

# Tableau Calculation and its capability

Hi All,

I have a the sample data pasted below.

• The data is getting pulled from SQL Server database
• Unique columns to make a record unique as shown below (Unique record is created by not just the 2 columns its in fact 22 columns that make a record unique.)
• Logic: a)  For Group = Gp1 and Product = P1: Count unique values of columns in F1 to F4 (sample number, actual is about 9 fieds. Do the distinct count for the four fields we have . so as per sample data here its calculated to 3 and we need to ignore the n/a values too.
•              use same logic for rest of the columns in Gp1 and Product = P2 and
•            b) Now For Group = Gp2 and Product =P1: Check if the value that has already occurred in previous should not be counted and ignored in the count and also ignore

n/a values. Basically as the Group changes we have to see if in previous products the values which already appeared should not be counted.

This calculation can be performed with some tricks and trips in small sample data but for the cases where our record uniqueness is displayed using 22-23 fields, I don't think its possible to do this in tableau.

There are two ways to handle this scenario through Table Calculation and Pivoting but with this kind of dataset it @gets way complex when deriving the granularity of the record. Please suggest with your experience on this.

Thanks,

Parvinder

 Group Product F1 F2 F3 F4 Total Gp1 P1 Sales Profit Deposits Sales 3 Gp1 P2 Sales Profit Profit Sales 2 Gp1 P3 margin shares n/a n/a 2 Gp2 P1 sales cash Desposits n/a 1 Gp2 P2 cash margin n/a sales 2 Gp2 P3 cheque customer n/a cash 3 Gp3 P1 broker swap n/a time deposit 3 Gp3 P2 sales cash n/a n/a 0 AT test1 test2 n/a n/a 2 DT test3 n/a n/a n/a 1