1 Reply Latest reply on Oct 27, 2018 6:55 AM by Ombir Rathee

    Convert to attribute

    Gavin Wong

      Does anyone knows what does it actually do. While reviewing one of the awesome videos by Andy Kriebel, he did this trick of converting one of the dimensions to Attribute and somehow it works. what actually went on ?

      How to Shade Under an Area Chart - YouTube

      See 7:10

       

      why does this work...?

      a link to the workbook is in his blog

      Tableau Tip Tuesday: How to Shade Under an Area Chart

       

      All credits go to Andy Kriebel for this neat trick but am trying to find out how does the attribute work.

       

      Appreciate if someone could shed some light on this.

        • 1. Re: Convert to attribute
          Ombir Rathee

          Even though this thread (https://community.tableau.com/thread/114562) clearly explained the Attribute function, let me try again to clear your doubts for this scenario.

           

          In the link shared by you, Andy created a Field Recession to differentiate the colors. When you convert a dimension to Attribute and use that in view, you're telling tableau to treat it as label. If you directly drag it into Marks card(Anywhere on Color, Size, Detail, Label) without converting to Attribute it will affect the level of detail of viz if there are more than 1 dimension members present.

           

          For example:

           

          If I drag directly it into Label or color it will affect the level of viz and tableau will create two different line charts. One for TRUE and another for FALSE values. Orange for True values and Blue for False.

           

           

          Let's create another field 'Attribute Example' with below code:

           

          IF  MONTH([Date]) >=1 AND MONTH([Date]) <= 4 THEN

              'A'

          ELSEIF MONTH([Date])>=5 AND MONTH([Date])<=8 THEN

              'B'

          ELSE

              'C'

          END

           

          If I drag this into Color, tableau will create 3 different line charts for all 3 conditions.

           

           

          When I convert it to Attribute, tableau treat this field as Label to differentiate the colors basis of month instead of affecting the viz level of detail.

           

           

           

           

          Attribute is also used to aggregate the dimension members. For example, In blending two different data sources, it is used to group the dimensions from secondary data sources. You may have also seen an error sometimes while creating calculated field 'Cannot mix aggregate and non-aggregate arguments with this function'. Tableau gives you this error when you try to use Aggregated measures along with disaggregated dimension in a calculated field. In that case ATTR function is used to aggregate the dimension so that aggregation level matches of dimensions and measures.

           

          Hope this helps and clear your doubt.