1 2 Previous Next 19 Replies Latest reply on Apr 30, 2018 10:06 AM by John Haselden

    How to use table calculation as basis for aggregation (The table calculation for X requires a field that is missing.)

    John Haselden

      Hi all,

       

      I'm on Tableau 10.5, I've shared a dummy workbook below, but the data looks like this:

       

      session_id
      page_id
      position
      1A2
      1D4
      1C6
      2D4
      2B2
      2A5

       

      I've created a calculated field that turns "position" into a rank like this: RANK(MIN([position]), 'desc'). I have it set to reset every session_id.

       

      So the data now looks like:

       

      session_id
      page_id
      positionRank
      1A23
      1D42
      1C61
      2D42
      2B23
      2A51

       

      What I want to do now is create a distinct count of session_id by page_id and rank. So the data should look somewhat similar to this:

       

      Rankpage_id
      distinct count session_id
      1C1
      A1
      2D2
      3A1
      B1

       

      However when I use the table calculation to do this I get the error, "The table calculation for Rank requires a field that is missing.".

       

      Does anyone have any ideas how I can accomplish this?

       

      A few things I've already considered but would like to avoid:

      • Doing these calculations within the query itself. I'm trying to make a dynamic dashboard based on a parameter so I need to do the calculation tableau side. I've considered putting the parameter within the query but the query takes too long to run.
        • This also rules out exporting and re-importing the data
      • Using a LOD calculation for each position as mentioned by Joey Minix in this post: https://community.tableau.com/ideas/4553
        • I'm not against LOD calculations in general, but this method slowed my dashboard down past a practical amount

       

      Any help would be greatly appreciated!

        1 2 Previous Next