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

    create intermediate calculations

    Patrick Grimal

      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?

       

      Many thanks in advance

       

      Patrick

        • 1. Re: create intermediate calculations
          Michel Caissie

          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
            Patrick Grimal

            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:

             

            CountryClassregionsub region
            AS18
            AS210
            AF16
            BS28
            BS24
            BF110
            CS28
            CF110
            CF212

             

            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

            CountryClassMaxRMaxSubR
            AF16
            BF110
            CF212

             

            for the second pair:

             

            CountryClassMaxRMaxSubR
            AS210
            BS28
            CS28

             

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

             

            REgards

             

            Pat

            • 3. Re: create intermediate calculations
              Michel Caissie

              Patrick, check in the attached...