12 Replies Latest reply on Dec 8, 2016 6:21 AM by D Barnetson

    Is there a workaround for referencing measure names in a calculated field?

    Brendan Bailey

      I am working on a project involving the recreation of an excel table in Tableau. I have no control over the format of the table, and must replicate it as closely as possible. I've spent quite a lot of time searching these forums for a solution, but can't seem to find anything that works.

       

      ABC.PNG

       

      I need to find a way to replicate the A/B/C headers on the left side of the table. This is essentially grouping the metrics into categories, but I'm having trouble writing the correct formula, since you can't reference measure names in a calculated field. I also want to do this without normalizing / pivoting the data into one column, as I believe this will cause other difficulties with mixing data sources, and formatting each row as shown above.

       

      This was how I imagined the formula would be written:

       

      CASE [Measure Names]

      WHEN "Metric 1" THEN "A"

      .....

      WHEN "Metric 6" THEN "B"

      .....

      WHEN "Metric 11" THEN "C"

      END

       

      It seems like this should be relatively simple, but I haven't been able to find anything that works, despite way too much time being spent researching. If anyone has a workaround or solution for this, I would GREATLY appreciate it! Attachments for data, and Tableau workbook. The calculated field (with error) is called "Measure Category"

       

      Thanks!