11 Replies Latest reply on Oct 25, 2019 6:58 PM by Mike Simon

# Total Innings Pitched in Decimal format

I am trying to display the number of innings pitched in a baseball game as a decimal value in this format:  "whole innings pitched.number of outs from partial innings."

If a player pitches 1 full inning and gets one batter out in the next inning, that value is displayed as 1.1.  If a player pitches 1 full inning and gets two batters out in the next, that value is displayed as 1.2.

When I add these values together, I'd like to display the total as 3 (three full innings pitched) not 2.3.

Innings Pitched is the raw data.  Actual Innings is a formula that converts partial innings to .33 or .667.

The grand total number of innings pitched in my data set is 35.2 (35 full innings and 2 outs from partial innings.

thanks for the help.

• ###### 1. Re: Total Innings Pitched in Decimal format

Hi Jack,

How are you using Actual Innings?  Is it the number of innings (full or partial) that a pitcher participated in?  If so, then it's just CEILING([Innings Pitched]).

Stuart

• ###### 2. Re: Total Innings Pitched in Decimal format

To clarify:  I'm not using actual innings.  I created that formula as an interim step in the event that I needed to convert partial innings to thirds.

I should have omitted that measure from the table before posting.

1 of 1 people found this helpful
• ###### 3. Re: Total Innings Pitched in Decimal format

I figured out a method of converting partial innings to full innings.  I'm sure there's a more efficient approach but this works.

I converted a total of 33.8 innings to 35 completed innings with 2 extra outs.

The field is "Displayable Innings Pitched."

The new file is attached.

1 of 1 people found this helpful
• ###### 4. Re: Total Innings Pitched in Decimal format

@jack.glavosek Can someone post the formula in this thread?  I don't have a full version of Tableau - only public and i cant open this file.   I need this calculation also.

1 of 1 people found this helpful
• ###### 5. Re: Total Innings Pitched in Decimal format

Mike,

Maybe you can try this method.

I'm assuming in a game a pitcher has 1 inning 2 outs represented as 1.2

and then summing over games they could have 4.4 which would be 5 innings + 1/3.

So then I'd first calculate the total for each pitcher in decimal format:

{ FIXED [Pitcher]:SUM([Innings])}

Then get the number of fractional innings as the number of additional outs:

10 * ( [Innings Total per Pitcher]-INT([Innings Total per Pitcher] ) )

Then using these two this would be the fractional version of the total:

STR(

INT([Innings Total per Pitcher]) //whole number part

+

INT ( [Outs additional] / 3 ) // divide by three to get additional innings from fractional part

)

+" "+

STR(ROUND( [Outs additional]%3,0 ) )  // use modulo 3 to get additional outs

+ "/3"

I've attached the datasource I used and the workbook in v2018.3 for others to check. 2 of 2 people found this helpful
• ###### 6. Re: Total Innings Pitched in Decimal format

Mike,

For your reference, here is the calculated field that Jack used:

sum(int([Innings Pitched]))+

int((
sum([Innings Pitched])-sum(int([Innings Pitched])))/.3)
+float(mid(
str(

round((((
sum([Innings Pitched])-sum(int([Innings Pitched])))/.3)-
int((sum([Innings Pitched])-sum(int([Innings Pitched])))/.3)),2)
),2,2))
/3

2 of 2 people found this helpful
• ###### 7. Re: Total Innings Pitched in Decimal format

I can't open your tableau - you'd have to save it to tableau public first.  I can't open a twbx

i will try to cut paste your formula tomorrow and let you know...

1 of 1 people found this helpful
• ###### 8. Re: Total Innings Pitched in Decimal format

i actually used Jacks formula and it worked!   I had issues with yours as i couldnt see the sheet to determine the values other variables you defined.  I would still like to see it if possible.

• ###### 9. Re: Total Innings Pitched in Decimal format

Mike,

Sorry for the delay.
See if this link to it on public works:

1 of 1 people found this helpful
• ###### 10. Re: Total Innings Pitched in Decimal format

Thanks a bunch this solved my problem!