Hey Shawn -
Unfortunately, no. I've thought something like this would be handy, too. What are you trying to do?
Russell, personally I think 'handy' is a bit of an understatement ;)
At least once in every workbook I put together I wish I could capture the value of these two and use them in a calculated field. My latest one has to do with sort. If I could simply put [Measure Values] in a calculated field it would be available to the sort by field drop-down menu. Then whatever Measure Name the user selected, the chart would be sorted on that Measure Value.
I know this can be done with a Parameter and a calculated field. But that's where the real problem comes in. I have a data set with 48 measures with 8 or so different number formats (dollars, percent, number without decimals, etc.). Unfortunately once you run through a calculated field all the Field Properties/Number Format's are lost. I have used Joe Mako's work-around to get the numbers to format correctly:
CASE [Which Label]
WHEN 'Prior Dollars Over Base' THEN RAWSQL_STR("FORMAT(%1,'Currency')",[Prior Dollars Over Base])
WHEN 'Inspections Sales' THEN RAWSQL_STR("FORMAT(%1,'$###,###')",[Inspections Sales])
(Thanks for that Joe.)
But that's 48 statement that have to first be written, and Tableau then has to run through them each time the user changes the parameter. It works, but it's not a very elegant solution.
On the other hand using the Measure Names quick-filter as the user selection device, and putting Measure Values on the mark label slot allows these two to function as intended and display mixed-number formats properly. If we had a [Measure Name] variable we could use it for all the things we use a parameter for now. And we'd be able to sort on [Measure Values].
Hope this made sense. BTW, I really like your software!
Russell, this would be useful when you have a denormalized dataset (zip code | measure 1 | measure 2 |measure 3, etc ) and you want to create a dashboard allowing the user to select a specific measure and have a heatmap in another sheet change dynamically depending on what measure selected selected.
I have a scenario where, for many Measures, there is a corresponding Dimension for which the value is essentially Red/Yellow/Green traffic light. Because I need to build a viz (boss's orders) that is a Text Table 8 Measures wide, I took to using Ye Olde Measure Values as the Text mark, and the Measure Names pill on the Columns Shelf.
Well, the boss wants the text numbers (values) colorized by the aforementioned Dimension, which, alas, is unique per Measure.
So, it would be wonderful if only I could create a Calculated Field, with " Case [Measure Name]... "
But, it appears that I can't and now I'm out of ideas.
It's a shame that some executives just want red-and-green blinkie lights, but I digress. ;)
+1, based on situations like Ken P describes.
And a yes please from me - exactly these slight lack of specificity when dealing with members of Measure Names/Values limits use.
Being able to have more detailed control of filtering from (linking to other sheets) via measure names/vals would be great too.
1 of 1 people found this helpful
FYI - I believe I have a solution for this.
- Create a parameter string list with the metrics you want to use
- Create a calculated field that simply translates each parameter value into its measure
- Use the calculated field above in the measure calculation
In my example, I want the ability to weight my price, cost, and other calculations either by Revenue, Quantity, or just get an Average.
- Previously I had been trying to use the parameter directly in my formula.
- Now I indirectly create a new Calculated field based on the parameter and then use that calculated field in the final formula
I don't normally do this, but finding this trick just saved me about 5 hours of dev time on this social media dashboard I'm working on!
I know we are currently attempting to weed out (archive) 4-year-old threads, and I have been a supporter of this effort. But seeing this old 'idea' reminds me that 'old' does not mean 'irrelevant' and this idea is just as relevant today as the first day I proposed it four years ago.
I also would like to 'dynamically' customize the format of a calculated field.
Here the issue I am facing: rounding -0.000001 should give me -0.0 instead of 0.0.
Replacing it by strings is not really sufficient. Any other ideas for workarounds?
It's rounding to the nearest decimal, which in this case is zero. I've never heard of a negative zero; zero is just zero. You can use FLOOR() but that will give you a -1.0 not what you're looking for.