How to create a calculated field that is based on group by value in Tableau?

  • Tableau FAQs
  • December 12, 2018
Get Started Transforming Your Data in Snowflake

To calculate values for a group, you need to use the LOD function FIXED. This will help you choose the granularity of the data and then get the value. For example, you may need to determine the maximum value from the regions, and you can use the following expression:

IF  {FIXED [Group]: 

    MAX([Sales YTD])}>3800000 

    THEN "TRUE" 

    ELSE "FALSE" 

    END

IF  {FIXED [Territory ID]:  – here we start the condition and specify the level of detail by the group. this will help us display values only for a specific group of detail

MAX([Sales YTD])}>3800000 – then we look for the maximum value inside the LOD function and compare it with our criterion. You can change this later depending on your needs.

THEN “TRUE” – further, if the previous condition is TRUE, then we output TRUE. this is the value that we want to display if the condition is true, but you can specify a different value or do other calculations with the data

ELSE “FALSE” – but if the condition is incorrect, then we also need to show something in the field, and since we have chosen the Boolean type, if the condition is FALSE, then we also output FALSE (you can also output any other value here)

END – here, we must indicate the end of the condition

20.01 Tableau

 


Up Next:

Read How to convert a timezone to a different timezone with a function in Tableau?

Related Posts

Top 5 Snowflake tools for Analysts- talend

Top 5 Snowflake Tools for Analysts

  • Ndz Anthony
  • February 26, 2024