4 Replies Latest reply on Oct 23, 2019 5:27 PM by Hari Ankem

    Trying to calculate correct # of innings pitched for baseball

    Mike Simon

      Hello,

       

      I am looking for some help on my simple problem.   I am trying to calculate ERA for a set of pitchers w/in Tableau.  

       

      In baseball P get credit for innings in 1/3.  So if a P pitches into the 2nd inning but gets only 2 outs in that inning he has pitched 2 2/3 innings, or 2.6667 in decimal format.

       

      In my csv file i have a 3 fields (Full Innings Pitched, Partial Innings Pitched, Total Innings Pitched)

       

      Partial Innings Pitched in my csv has values of either (0, .3333 or .6667)  - this way if i add these #s up they will round up to a whole #  100.3333 + 100.6667 = 201.0 Innings P

       

      Simple enough.

       

      Problem # 1 - When i look at the data when its ingested into Tableau it now shows up like below.

      Its truncating and rounding the data to 2 or 3 decimal places (down from the 4 places in the CSV file) which i believe is causing issues with my calculations later on.

       

      .6667 in the CSV becomes .67 and .667 in Tableau

      .3333 in the CSV becomes .33 and .333 in Tableau

       

      The source CSV is formatted this way.  You can see the values all have 4 places after the decimal point.  This is the format that i want it to be in when it gets into Tableau.

       

      You can see that now my decimals are not .3333 or .6667 in import (i have .9998 and .0001 and .3334, etc values) showing up on my graph. 

       

       

      Can i change the format of the data in the DataSource field?  If not how do i change the measures of those fields in Tableau to be 4 decimal places again?  I need to get my measures back to 4 decimal spots for proper additions to work.

       

      2nd part of my question if we can fix the above so my calculations work correctly.  My output will be 3 results for Total Innings Pitched:

       

      1) Whole # = 100

      2) 1/3 inning = 100.3333

      3) 2/3 inning = 100.6667

       

      Is there way with Tableau to say if the value contains .3333 then display 100.1 and if the value contains 100.6667 then display 100.2

       

      Thanks in advanced for the help

       

      ~Mike