2 Replies Latest reply on Aug 21, 2017 6:42 AM by Niranjan Patil

    How to use filter values in calculated field for dynamic calculation ?

    Niranjan Patil

      Hello All,

       

      I am very new to Tableau. I have been trying to do calculation using selected values from filter but there is no way to get those values in Tableau.

       

      Here is my calculated field where i am taking an average.

       

      A_count + B_Count + C_Count + D_Count + E_Count + F_Count / 6   ( values of A_count ,B_Count ,C_Count ,D_Count ,E_Count ,F_Count  are coming from other calculated fields)

       

      My filter is on values i.e. A, B, C, D, E, F (Filter type is multiple value(list) )

       

      My requirement is :

       

      when I select any of these values my calculation should change accordingly like below

       

      say I selected A, D and E then my calculation will be

       

      A_Count + D_Count + E_Count  / 3.    (selected values divided my number of selected values i.e. average)

       

       

      I am looking for logic like below

       

      If  select values = 'A' and select values = 'D' and select values = 'E'  then

            A_Count + D_Count + E_Count  / number of selected values end.

       

       

      I have tried using ATTR() and countd() function in Calculated field but it only works for single selection.

       

      countd() funtion gives me count of selected filter values but i am not able to get actual values tso i could't able to perform above calculation.

       

       

      I am really struggling to get this result. Please help on this.