6 Replies Latest reply on Aug 16, 2016 12:18 PM by S D

# Calculated Field - Number Generator

Hi Team,

Very simple question, I am trying to create a dimension consisting a range of number, let say 1 to 10 (1,2,3,4,5,6,7,8,9,10).  Can you use a calculated field to create this series dynamically?

Thank you much!

• ###### 1. Re: Calculated Field - Number Generator

You might like this post:

• ###### 2. Re: Calculated Field - Number Generator

Thank you Matt for the quick reply.

I need the number in sequence though not random (i.e. 1 to 10: 1,2,3,4,5,6,7,8,9,10)

• ###### 3. Re: Calculated Field - Number Generator

Sounds like something INDEX() or RANK() could easily accomplish, but I'm not sure how familiar you are with Table Calculations.

• ###### 4. Re: Calculated Field - Number Generator

I would like to use it as a dimension though.

Can you you put INDEX() in an IF statement to return integer less than 10?

Thank you again Matt!

• ###### 5. Re: Calculated Field - Number Generator

Just use "Modulo function": Modulo Function in Tableau Software | Tableau Software

(INDEX() % 10) + 1 will give you sequence of numbers from 1 to 10.

• ###### 6. Re: Calculated Field - Number Generator

Yes Index function works perfectly for generating a number and prefix (or) suffix with generic text and use in display to show as value.

Thanks,

SD