2 Replies Latest reply on Jun 12, 2012 1:58 PM by Justin Larson

    return dimension (or measure) name as result of formula

    Justin Larson

      Is there a way in Tableau to return the name of a measure or dimension as the result of a formula? The purpose of this calculation would be to provide a dynamic field available that could calculate a text result. For my purposes, this would not be an aggregate function. For example, formula that returns the measure name that has a value nearest to a value within a record, or the measure name that has the highest value in the record.


      In excel, this would be easiest to represent as either an indirect formula, or an index that looks at the headers. For example, a formula to return the name of the measure with the highest value in the row (in Excel) would look like:


      =index([Headers],match(max([values in row under headers],0))


      For clarity, I am NOT after a list of nested IF statements with manually typed in text within the formula. That is not an eloquent solution, and I know how to do that.


      For a more specific example, when you pull Census data, you get data-wide format. In my case I've got a list of zip codes, one row for each zip code, and the columns are each a decade, with values that represent the count of houses built within that decade. I'd like to have a succinct way (via formula) to extract the decade that meets my criteria. In line with the example above, I'd want to be able to run a formula who's result is the decade that has the most houses in it. Not the measure value itself, but the measure name based on the measure value.


      This Dimension could then be used for color maps, or calling up labels, etc.