4 Replies Latest reply on Jul 9, 2012 11:50 AM by Dani Schmid

Return Min Max in Calculated Field

Hi,

I need a calculated field that only contains two entries, the min([some column]) and the max([some column]). It is straightforward to calculate either of them, but I cannot figure out how to return them together.

Cheers,

Dani

• 1. Re: Return Min Max in Calculated Field

Hi Dani,

Do you want the two entries to be combined? As in they are added together or would you like them to show as two different values, but using one calculated field?

For the first scenario, the calculation might look similar to the following:

min([Profit]) + max([Profit])

For the second scenario, in order for them to both show up, the values will need to be turned to strings. Therefore, the calculation may look similar to this:

"\$" + str(min(Profit)) + ", \$" + str(max(Profit))

Hope this helps a bit!

-Tracy

• 2. Re: Return Min Max in Calculated Field

Hi,

thanks for this. But what I want is the following:

Assume that I have table that consists of one column called Xall, which has

the following entries:

1

2

3

4

5

I want to calculate a field Xcalc that only contains two entries: the minimum AND the

maximum value of Xall, i.e.

1

5

Can this be done?

Cheers,

Dani

• 3. Re: Return Min Max in Calculated Field

Hi Dani,

To show the two values within the same calculation, the formula would need to look similar to the following:

str(window_min(sum([Order Quantity]))) + "; " + str(window_max(sum([Order Quantity])))

The other option would be to create two different calculations:

window_min(sum([Order Quantity]))

window_max(sum([Order Quantity]))

Since table calculations are being used in these calculations, it may be necessary to right click and select Compute Using-->the appropriate direction.

Hope this helps!

-Tracy

1 of 1 people found this helpful
• 4. Re: Return Min Max in Calculated Field

Petty that Tableau does not seem to know array (vector) constructors.

Thanks.

Dani