Skip to main content

Hi Folks,

 

I am trying to create a calculated field based on three conditions .

 

I have two columns names " source system names"  which has only two values 302 and 202 only and other column name "unique ID have different numerical values .

 

I want to create a calculated field which will display the data as shown in "calculated field display " column. I need some help to write a logic on this .I have not done something like this before in tableau .Can someone help me out .I have around 0.5 million rows so need a logic that would work for this size of data .

 

202 RECORD ONLY - when unique ID does not exists in row having source system as 302 .(example row 1,3 and 4)

302 RECORD ONLY - When  unique ID does not exists in row having source system as 202.(example row 9,11 and 12)

EXISTS in both 302 and 202 - when unique ID is same for source system names 302 and 202 .(2 and 10 , 5 and 8 and 6 and 7)

 

Kindly help me to create a calculated field with this logic .

12 answers
  1. Aug 7, 2019, 4:35 PM

    IF {FIXED [unique ID]:COUNTD([source system names])}=2

    THEN "EXISTS in both 302 and 202"

    ELSE

    (

       IF  {FIXED [unique ID]:MAX([source system names])} = 302

        THEN "302 RECORD ONLY"

        ELSE "202 RECORD ONLY"

        END

    )

    END

     

    Tableau shouldn't have a problem doing it over 500K records. Might take a few seconds, I'd say.

    If it takes too long for your liking, depending on the source, if it's a database, you can do it in the database.

0/9000