6 Replies Latest reply on Nov 8, 2018 12:35 PM by SOU SOU Phomsavanh

    Count distinct values with conditions

    SOU SOU Phomsavanh

      Hello

       

      After trying on my own for a while I need a little assistance. Essentially I want to the count the number of distinct number of FININSTRNAME (Stock names) that have an edited value. With the sample data below the count should be 4, I also included 2 calculated fields that I've been trying with no success. Any help would be great appreciated, also attached is the workbook. I have Tableau 2018.1.2 if that makes any difference

       

      Calculated field 1:

      IF [Edited Prce] = 0 THEN 0

      ELSE

      END

       

      Attempted Calculated Field 2:

      IF ATTR([Edited Prce])= 0 THEN 0

      ELSEIF ATTR([Edited Prce])>1 THEN COUNTD([Cusip])

      END

       

       

                                                                                                                                                                                                                                                                                                                                                                                                                                         

      FININSTRTYPEFININSTRSYMBOLCUSIPFININSTRNAMEEXPDATESTRIKEPUT_CALLCODEOVERRIDETYPEPREVIOUS_PRICEEDITED_PRCECREATEDBYCREATIONDATELAST_EDITED_BYLAST_EDITED_DATE
      OPTNAMLP  nullAlerian MLP   ETF                                   ######## 0000005.000C   Volatility0.280.28########                    ########
      OPTNAMLP  nullAlerian   MLP ETF                                   ######## 0000005.000P   Volatility0.280.28########                 ########
      OPTNAMLP  nullAlerian   MLP ETF                                   ######## 0000006.000C   Volatility0.280.28########                ########
      OPTNAMLP  nullAlerian   MLP ETF                                   ######## 0000006.000P   Volatility0.280.28########              ########
      OPTNSHY   nulliShares   1-3 Year Treasury Bond ETF                ######## 0000083.500C   Volatility0.020.02########          ########
      OPTNSHY   nulliShares   1-3 Year Treasury Bond ETF                ######## 0000083.500C   Volatility0.3121340.02################
      OPTNSHY   nulliShares   1-3 Year Treasury Bond ETF                ######## 0000083.500P   Volatility0.2988430.02################
      INDXUS10  9999US109      Nasdaq   US 10-Yr Treasury Index                    ######## Final   Price096.858################
      OPTNWEAT  nullTecrium   Wheat Fund                                ######## 0000001.000C   Volatility0.444950.25################
      FUTUAD    nullCME   AUSTRALIAN DOLLAR                             ######## REVPnull0################
      FUTUAD    nullCME   AUSTRALIAN DOLLAR                             ######## REVSnull0################
      FUTUAD    nullCME   AUSTRALIAN DOLLAR                             ######## REVPnull0################
      EQUIAGIO  00847X104      AGIOS   PHARMACEUTICALS ######## Final   Pricenull0################
      EQUIALGN  016255101      ALIGN   TECHNOLOGY INCCOM                           ######## Final   Pricenull0################

                 

       

       

       

                                                                                        

      INDXUSSH  9999USSH3      Nasdaq (Nordic)   US Shredded Steel Future          ############ Final Price0330.97sphom01                       11/1/18 9:49 asphom01                       11/1/18 9:48 a
      INDXUS10  9999US109      Nasdaq   US 10-Yr Treasury Index                    ############ Final   Price096.858blee01                        11/1/18   14:14 ablee01                        11/1/18   14:12 a
      OPTNWEAT  nullTecrium   Wheat Fund                                12/21/18   0:00 a 0000001.000C   Volatility0.44494980.25sphom01                       11/1/18   15:48 asphom01                       11/1/18   15:48 a