9 Replies Latest reply on Jul 23, 2015 2:43 PM by Corey Turner

# Storing the values of calculated field in a variable

Hey All,

Is there a way, we can store the value of the calculated field into a variable without the formula behind it? Like storing the output in a variable in a normally programming language? I want to store the values like a constants to a variable name, without the formula behind it. Is there a way to do that?

Thanks

Ijaz

• ###### 1. Re: Storing the values of calculated field in a variable

Have you tried creating a parameter instead?

• ###### 2. Re: Storing the values of calculated field in a variable

Ijaz,

To store constants in Tableau you can use parameters. If you give some details on why you are trying to do this you may be able to avoid the problems you are running into. What are you trying to accomplish?

• ###### 3. Re: Storing the values of calculated field in a variable

Hey Corey Turner

Please find the attached worksheet. I wanted to find the sum of the counter values. My counter starts from 0 - 64. then goes back to 0 and starts again. I wanted to find the total count. So from first 1-64, then it should continue from 65. I have done lot of calculations and finally come up with last column calculation2 with what I want. I want to store this value in a variable, so that I can plot the time vs calculation2 alone.

Can this be done?

Thanks

• ###### 4. Re: Storing the values of calculated field in a variable

Hey Tom W

Please find the attached worksheet. I wanted to find the sum of the counter values. My counter starts from 0 - 64. then goes back to 0 and starts again. I wanted to find the total count. So from first 1-64, then it should continue from 65. I have done lot of calculations and finally come up with last column calculation2 with what I want. I want to store this value in a variable, so that I can plot the time vs calculation2 alone.

Can this be done?

Thanks

• ###### 5. Re: Storing the values of calculated field in a variable

I'm not sure I am totally following you, but you can plot calculation2 against time by just making them both continuous and removing the other fields from the detail...

See the attached twbx. Is this what you were looking for?

1 of 1 people found this helpful
• ###### 6. Re: Storing the values of calculated field in a variable

Hey Corey,

What you did was not I wanted exactly. But I tried some from what you told and I was able to get what I wanted. Just of out curoisity, is there any other way, we can add the counter values?

For eg, I have 1-64 and then it starts from 1 and goes on.. I want an output where 1-64 values are displayed and after that it start from 65 instead of 1. I have got the values using the calculated fields in the attached workbook. But it is too complex. Is there a simple way to do it?

Thanks

• ###### 7. Re: Storing the values of calculated field in a variable

Also can you tell me how to store the calculation2 column inside a parameter and use it? I am relatively new to tableau and I would be happy to know about it. If you can help me it would be nice.

Thanks

Ijaz

• ###### 8. Re: Storing the values of calculated field in a variable

You can use the INDEX() function to get the row number, this is one way to increment the count. It looks like your count field doesn't have all the values from 1-64 so the index doesn't line up exactly.

• ###### 9. Re: Storing the values of calculated field in a variable

You cannot store a value from a calculated field in a parameter right now. Parameters are great for using constants or user defined values that can be used in calculated fields / filters.

But, you can use that calculation2 field in another calculated field. This may be what you are looking to do.