2 Replies Latest reply on May 4, 2018 1:04 PM by Dustin Greelis

    If [categorical] = group1, then [calculated_aggregated_field] end - *help!*

    Dustin Greelis

      I have 3 lines on the same graph, each created with a calculated field that assigns a weight to the variable if it is in the correct group:

       

      Here's an example of one of them:

      if [Primary Bank] = "Top 11 Banks" then [Weight Roll4] END

       

      Now I am trying to use a more complicated weighting variable that is a calculated field in the place of the "Weight Roll4" variable in the equation currently, but I'm getting the "cannot mix aggregate and unaggregated blah blah blah" error.

       

      Does anyone know of a way to do this?  I've tried a few things, including this tutorial: Error "Cannot mix aggregate and non-aggregate arguments with this function" When Creating a Calculated Field | Tableau S… but couldn't get any of the solutions to work.  

       

      Thanks for taking the time guys!

        • 1. Re: If [categorical] = group1, then [calculated_aggregated_field] end - *help!*
          Michael Ye

          Using ATTR([Primary Bank] ) instead of [Primary Bank] .

           

          Thanks,

           

          Michael Ye

          • 2. Re: If [categorical] = group1, then [calculated_aggregated_field] end - *help!*
            Dustin Greelis

            Hi Michael,

             

            Thank you so much for going through the time to answer that.  I'm sorry for the late reply... it's hard to find time to work on Tableau at work.

             

            I would love to test out your response, but I'm stuck on something that won't allow me to get to the point where I can test your response.  I'm stuck on a more basic thing.  I'm just trying to make my lines (computed with calculated variables) show the percent that they are of the entire line.

             

            In the example, I'm trying to show the percent that each response accounts for, out of the total number of responses.  I used colors in this example, across 3 variables that I pivoted.  I figured computing using "Pivot Field Values" would be the same as "Table (down)" to get the total % that one color is out of the rest.  What confuses me, is that "Yellow" shows 0, when the dataset shows it's much higher.  This is the equivalent of the problem I'm having in my dashboard.

             

            Any ideas why this might be?

            Thanks again!!

             

            P.S. for more in-depth info into the data and calculated variables, read the below:

             

            In my example, I created a trailing 8 (2 year) weight that combines the weight of the earlier year (e.g. 2011 in the 2011-2012 time frame) with the later year's weight (2012 in that example).  Then, I created variables that take the percent of that total divided by the window_sum to get my total trailing 8 weight percent (does that make sense?  I followed a tutorial and don't understand it well myself).