3 Replies Latest reply on Sep 11, 2017 9:34 AM by Michel Caissie

# create intermediate calculations

Hello team

my tableau report is collecting many data for some regions.

I need for each region to generate a calculated value that I want to reuse for other calcultaion.

By example, for region A, I have some data like:

range,sub-range that can take different values like:

5,10

5,8

6,10

6,12

...

I need to collect into 2 variables subrange5 and subrange6, the max sub range value for each range value.

These variables should be reused in other calculation, different worksheet ..

I tried this but .. in some worksheet, it seems that values are not the good ones ..

if attr([range])="5" then max([sub-range]) end

Then can I reuse the subrange5 later?

Is it possible, and can you give me some tips on this?

Patrick

• ###### 1. Re: create intermediate calculations

Patrick,

You can use lod to compute the max sub-range per range

[Max SubRange]

{FIXED [range]: MAX([sub-range])}

then

[subrange5]

MIN(if [range] = 5 then [Max SubRange] end)

I use MIN  but could be MAX or AVG  but not SUM, because each row will get the value of the max subrange  for the given range.

Michel

1 of 1 people found this helpful
• ###### 2. Re: create intermediate calculations

Thanks Michel

this help me going to the good way, but my case may be is a little be more complex, and as I'm not so familair with LOD..

If you still have some few minutes, my case is more this one:

The data I collect are these ones:

 Country Class region sub region A S 1 8 A S 2 10 A F 1 6 B S 2 8 B S 2 4 B F 1 10 C S 2 8 C F 1 10 C F 2 12

I want to create two wariables [max region], and [max sub region], taht will show

for each pair[Country]/[Class], the max value of region, and the max value of sub region associated with the max region..

Not sur I'm clear enough.. but here is what I expect:

for the first pair

 Country Class MaxR MaxSubR A F 1 6 B F 1 10 C F 2 12

for the second pair:

 Country Class MaxR MaxSubR A S 2 10 B S 2 8 C S 2 8

Many thanks if you can find some minutes again for this example..

REgards

Pat

• ###### 3. Re: create intermediate calculations

Patrick, check in the attached...