4 Replies Latest reply on Nov 9, 2012 2:26 PM by Alex Kerin

# Can I display decimal data in a fractional format?

I have a series of data that is in a decimal format but I want to display the averages of the data in a fractional format. Is this possible? I have gone into my CSV file and added a columb with the decimal data calculated to a fraction but tableau says it is null.

Its probably very simple but I just started with Tableau yesterday.

Dave

• ###### 1. Re: Can I display decimal data in a fractional format?

Fractional as 1/2 , 1/4 etc. or rounded somehow?

• ###### 2. Re: Can I display decimal data in a fractional format?

I wish to display theses numbers as 32's rounding to the nearest

• ###### 3. Re: Can I display decimal data in a fractional format?

You could create a calculation to do that. Here I've broken it down into multiple parts, but you could have one calc

A calc [Value Agg] that is the aggregation you are using for your bars - e.g. sum([sales])

And the actual string to put on the label shelf

if int([Value Agg])<>0 then str(int([Value Agg]))+" " else "" end +

str(round(([Value Agg]-int([Value Agg]))*32,0))

+ "/32"

This checks to see if the number has an integer component (i.e. we don't want to show 0 12/32), displays the integer if we do, creates another string that has the 32ths (find the decimal part by removing the integer part, multiply by 32, and round), then add the string "/32".

I'm guessing with the way the round goes, you could end up with 3 32/32, so you may want to error check that, but this should give you a start.

See attached

• ###### 4. Re: Can I display decimal data in a fractional format?

I always end up fixing these...

To get rid of the 0/32 and 32/32 we need to round the aggregate first to the nearest 32th, then also check we're not writing out 0/32.