9 Replies Latest reply on Mar 10, 2017 7:21 AM by Jamieson Christian

    Duplicate Measure Names

    suvas.chandra

      I am planning to use Measure Names as a filter. All the measures in my workbook/worksheets are converted to "Attributes" from SUM. But the problem is, in the drop down box of Measure Names, it is showing as duplicate values with one of them tick marked. How can I remove the duplicates ?

       

      If the Measure Values are SUM, then it doesn't show two values:

       

       

       

      How to resolve this ? Anybody came across this type of scenarios ?

        • 1. Re: Duplicate Measure Names
          Jamieson Christian

          Suvas,

           

          The Measure Names filters include the default aggregation for each measure. In most cases, this is SUM. If you use a different aggregation, it creates a separate entry on the Filters shelf.

           

          To get around this, you will need to create a calculated field for each of your measures, that performs ATTR([My Measure]) in the calculation. Once you have done that, Hide all of the original measures, so that only your calculated measures are left. Every one of these will have a default aggregation of AGG (which literally means "the aggregation is already built into the calculation"), so you will not have to override the aggregation on the Measure Values shelf, and Tableau will not try to create additional entries in the Filters list.

           

          Side note: If your ATTR aggregations never yield asterisks * you can use MIN instead. MIN and ATTR yield the same results except in cases where MIN <> MAX (which is where ATTR outputs an asterisk).

           

          Hope this helps.

          2 of 2 people found this helpful
          • 2. Re: Duplicate Measure Names
            Tom W

            The measure name filter will always contain an entry for each of the measures in the pane in on the left as per their default aggregation, there's no way to remove them as far as I know

             

            See this idea - https://community.tableau.com/ideas/1274

            1 of 1 people found this helpful
            • 3. Re: Duplicate Measure Names
              suvas.chandra

              I have done all the parts before this post but hiding the original object. I did hide from the left pane. I also did "Hid all unused fields". But, the original object still appears in the drop down of "Measure Names".

              • 4. Re: Duplicate Measure Names
                suvas.chandra

                I had to refresh it. Yes, it went away. Thank you very much.

                 

                One more question, do you know why was I required to use ATTR for all the measure values (around 15) to get the correct results. I never saw any scenarios like this. The data comes directly from the database. All the fields are straight forward. Any advise ?

                • 5. Re: Duplicate Measure Names
                  Jamieson Christian

                  Suvas,

                   

                  Sorry, I forgot to mention that the Quick Filter list has to be "refreshed" (changing from Include to Exclude and back again does the trick) to get it to update with the correctly list of measures.

                   

                  As to your other question,

                   

                  Measures are always subject to some form of aggregation when they're on the view — even if the view is segmented with enough dimensions that each row in the view corresponds to a single row in the raw data.

                   

                  Whether ATTR was necessary, or MIN was sufficient, or SUM would have worked fine, I don't know. I would have to see your packaged workbook to fully understand what you're doing.

                  2 of 2 people found this helpful
                  • 6. Re: Duplicate Measure Names
                    suvas.chandra

                    Jamie, I am attaching the workbook. Please have a look into this. It doesn't return correct data unless I use ATTR. I don't know why.....

                     

                    A meaningful explanation will be appreciable

                    • 7. Re: Duplicate Measure Names
                      Jamieson Christian

                      Suvas,

                       

                      I went to "Sheet 1", where you had lot of ATTR(Measure) on your Measure Values shelf. I was able to change all of them to MIN without any of the values changing in the view. See attached modified workbook (version 10.1.5)

                       

                      Maybe I'm confused about what you observed. Can you clarify where in the workbook I should be looking for instances where incorrect data is returned if anything besides ATTR is used?

                       

                      Keep in mind, the ability to replace ATTR with MIN was just a side observation. Either one will work fine when you set up your calculated fields; I prefer MIN because it has a very slight performance advantage, but it really doesn't matter much.

                      • 8. Re: Duplicate Measure Names
                        suvas.chandra

                        Jamie,

                         

                        You are looking at the right place. The question is why am I required to change all measures to ATTR. If I use ATTR, it returns correct result. Why for all the measures ? I am puling data directly from the database.

                         

                        Suvas

                        • 9. Re: Duplicate Measure Names
                          Jamieson Christian

                          Suvas,

                           

                          To reiterate:

                          Measures are always subject to some form of aggregation when they're on the view — even if the view is segmented with enough dimensions that each row in the view corresponds to a single row in the raw data.

                           

                          ATTR is just a convenient form of aggregation to use if you know that your view segmentation is going to result in each mark on the view corresponding to either (1) a single row in your source data or (2) a set of rows that will all have the same value.

                           

                          ATTR equates to, "If the value of this field is the same for all relevant rows of data, display that value. Otherwise display a special value to indicate multiple underlying values." (Usually an asterisk * is displayed as the special value.)

                           

                          In the background, ATTR roughly equates to this:

                           

                          IF MIN([Field]) = MAX([Field]) THEN [Field] ELSE NULL* END
                          

                           

                          * It's not actually a NULL that's returned when there are multiple values — it's some other special designation that is not conveniently exposed to calculations.

                           

                           

                          When you use ATTR in a context where you expect to always see values, and never see the asterisk * designation, then you can use MIN or MAX just as easily, because MIN([Field]) = MAX([Field]) = ATTR([Field]).

                           

                          I hope this helps explain how ATTR works.