1 Reply Latest reply on Jun 2, 2017 9:59 AM by Joe Oppelt

    Comparison of calculations

    Germán Impa Mendía

      I have different ways of doing a calculation and I would like to know the difference between them.


        • 1. Re: Comparison of calculations
          Joe Oppelt

          Logically, they are all the same.


          On two of them you are doing CNTD of whatever gets filtered onto the sheet.  Using the filter this way shrinks the rows that are in the table underlying the sheet.  In your case you have only 6 rows in the actual data table being used for the sheet.  (Using either method of filtering.)  At times this is an advantage -- especially when the actual data source has a HUGE number of rows.  But it also has disadvantages in that you only have these 6 rows in the table for the sheet, and if you wanted to compare the number of rows for 'Alquilada' against the number of rows for 'Heredado', you would not have 'Heredado' in the table at all.


          Methods 2 and 3 each create a calc that gets you the countd.  Method 2 is a row-level calc.  You get a value for each row in the table (in your case, either the value of the ID, or NULL.)  Then you can do the COUNTD on that.  Method 3 is an aggregate calc.  This does the work inside the parentheses of the aggregate inside the calc.  (That's why you see Tableau put it on your sheet as AGG([calc name]) when  you put it on the TEXT shelf.  It will work at whatever dimensional level that your sheet uses.  In your example there are no dimensions, so it occurs at the sheet level, but if you had a date field on the sheet, for example, you would see the aggregation performed at the date level.


          The advantage of one method over another often depends on the design of the sheet.

          1 of 1 people found this helpful