NewDataLabs

Tableau - Business Intelligence Tools

  • Solutions
    • ETL
      • Tableau Prep
      • Airflow
      • Power Query
      • Microsoft Integration Services
      • Fivetran
    • Data warehouses
      • Snowflake
      • Google Big QUERY
      • Microsoft SQL Server
      • PostgreSQL
      • Web analytics
      • Amplitude
    • Business Intelligence
      • Tableau
        • What is Tableau?
        • How to implement Tableau properly?
        • Interactive management dashboard
        • Tableau price list
        • Products of Tableau
          • – Tableau Desktop
          • – Tableau Server
          • – Tableau Prep
          • – Tableau Online
        • Tableau Audit
        • Tableau Day
      • Power BI
  • Services
    • Tableau workshops on your data – Proof of Concept
    • Preparation of data – ETL
    • Reporting and data visualization
    • Migration services
    • Tableau training courses
    • Embedded Analytics
  • Salesforce
    • Salesforce CRM
      • Customer relationship management
      • Sale
        • Sales opportunity management
      • Business Intelligence analysis
      • Salesforce Manufacturing Cloud
      • Salesforce Service Cloud
      • Salesforce Marketing Cloud
    • Services
      • Proof of Concept
      • CRM workshops
      • Implementation of CRM
      • Post-implementation support
      • Data migration
      • Salesforce training
      • CRM consultancy
      • Salesforce integrations
    • Tableau + Salesforce
  • About Us
  • Customers
    • Our Customers
    • Customer stories
      • Totalizator Sportowy Sp. z o.o.
      • Snieżka S.A.
      • Werner Kenkel Sp. z o.o.
      • DOZ S.A.
  • Events
    • Webinars >
      • Salesforce
      • Tableau
      • Power BI
    • Tableau Training Courses >
      • New Data Model
      • Tableau online course
      • Tableau training courses
    • Power BI Training Course
  • Blog
  • Download Tableau
    • Tableau Desktop – Trial
    • Tableau Server – Trial
    • Tableau Prep – Trial
    • Tableau Reader
  • Contact
EN / PL

Ad-Hoc Calculations: How They Work, When to Use  Them and When to Avoid Them?

2024-02-13

Just a few clicks and your calculation is ready, without opening the dialog window. Often without a title, and sometimes with the title that you cannot get in any other way. Ad-hoc calculations: when they can be a blessing and when a curse?

What are ad-hoc calculations?

There are at least seven or eight ways to write a formula for the calculation field in Tableau. And from those, one stands out in particular. Most will lead to creating a field that will be listed in the Data Pane section. Such fields have the names that can be later used as headers in the tables or charts. In contrast, an ad-hoc calculation will never be listed on the left side of the screen. You can create it by double-clicking on the Rows, Columns or Marks shelf. When it comes to their titles… there are different approaches to choose from.

For what can you use ad-hoc calculations?

Ad-hoc calculations can be helpful when you need to create something in Tableau on the spot. There is no need to open the dialogue window of the calculation field, and your ideas how too modify the visualization can be implemented straight away. There are also more sophisticated ways in which ad-hoc calculations can be used.

Pill “duplicate”
From time to time, you may need to format one field in a variety of ways in your visualization. For example, when you have thousands of labels with accurate values in tooltips. As a rule, Tableau does not allow it, but you can solve this problem if you have two copies of the same pill. This will create another issue – disorder in the Data Pane section. Using an ad-hoc calculation will help avoid this. For example, you can place an ad hoc [Sales]*1 calculation on the Marks shelf in the Tooltip tab. The value will remain unchanged, and Tableau will identify this element as a new field. This way you can have separate formatting for [Sales] and [Sales]*1.

Add headers on request
Charts or tables often have headers that are not suitable for whatever reason. For instance, the naming convention assumes that every field relating to the parameter should include PAR in its name. This makes understanding the report easier for other users, who will need to modify it. However, the name “QUARTERLY SALES PAR” isn’t what you want other users to see. In this case, you can modify the pill “QUATERLY SALES PAR” by using the ad-hoc calculation. There are two ways to do that.

In the ad-hoc calculation pill, you can enter the required name before the name of the relevant pill after two // characters or inside the symbols of the block comment – /*  */. In the first case, after entering the required name press Shift and Enter before entering a formula. This will move your formula to the next line. There is no need to do this if you use block comments. When you apply this to your report, it may look like this:

Are ad-hoc calculations always a good idea?

When working with ad-hoc calculations, you should be aware that they have several considerable drawbacks. This means that you need to use them consciously. Why?

  1. They are not visible in the Data Pane section

When you come across an unknown field in the visualization, you usually check the Data Pane section. To learn more about this field, use Describe or open the Calculation Editor. But when these options fail, some Tableau users can wonder what to do. Even if you realize that it’s an ad-hoc calculation, but you encounter syntax which contains //, you may still be confused. Take a look at the above illustration – with this syntax, you should know that clicking through it will not suffice. You need to move the arrows up and down to unhide the remaining calculation using both Shift and Enter. Syntax with block comments will definitely have the edge.

  • Not available in functions

Those who like to use a list of fields in the suggestions for calculations, may not find ad-hoc calculations there. You cannot access them either through the action filter fields, Replace References, or in any other lists available in the field report. They exist only locally on a particular shelf. This can hurt. Changing the filtering field to the ad hoc calculation can turn the filtering action off. By using Replace References, you can swap the selected fields out in all calculations and on all shelves of the report. All, except for the ad-hoc calculations.

What to do? Give up using ad-hoc calculations? Not necessarily.

They can be very helpful when you are building a report and reviewing the data. They enable flexibility and speed. However, when the report goes into the production phase, it is best to switch to the traditional calculations. These approaches should be applied only occasionally when creating reports. They can be used to resolve a bottleneck with the header. In such a case, it’s better to opt for block comments instead of two //. Below you can see how to swap out the ad-hoc calculation for the ordinary calculation.

Agata Mężyńska, Tableau Desktop Certified Professional

Webinars
> Amplitude Webinars
> Tableau Webinars
> Power BI Webinars

Tableau training courses
Power BI online course
ETL
> Tableau Prep
> Airflow
> Power Query
> Microsoft Integration Services
Data warehouses
> Snowflake
> Google BigQuery
> Microsoft SQL Server
> PostgreSQL
Business intelligence
> Tableau
> Salesforce
> Power BI
Web analytics
> Amplitude
Salesforce
> Customer relationship management
> Sale
> Sales opportunity management
> Analysis Business Intelligence
> Salesforce Manufacturing Cloud
> Salesforce Service Cloud
> Salesforce Marketing Cloud
Contact

contact@newdatalabs.com
contact@newdatalabs.com


601797783
+48 781 648 194


Adres
Correspondence address:
al. T. Boy’a – Żeleńskiego 26,
51-160 Wrocław

Copyright © 2025

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}
The newdatalabs.com/en website uses cookies. We use information saved using cookies and similar technologies, including for advertising and statistical purposes and to adapt our website to the individual needs of users. By continuing to use the site, you agree to the terms.Close