How many treatment types are we dealing with here? I'm trying to figure out if it's something you can manage with a parameter or if it needs to be dynamic.
What's your original data source?
Right now we have four (4) treatments with a potential of scaling up to twenty(20) over time. I've looked at using parameters but they are single select and unless there is a way around that, it won't accomplish what I'm looking for.
I'm less concerned with the dynamic aspect of this for the time being. If we can find something that works for 4 treatments, then I can create a procedure to scale up down the line when necessary.
Anyone? Could really use a hand with this.
You're looking for Tableau to generate data (without actually reading something in).
If I had to do this, I would have some excel file that had all the possible Matrix Code combinations in one column.
If your actual data file doesn't have all the matrix code combinations, you'll never get a full filter list of all the Treatment Type combinations for your filter list. That's why I would force it through some extra data source.
If your data can guarantee all matrix codes, you could have a calc that generated all the Treatment Types like this:
case [matrix code]
when "0000" then "null"
when "0001" then "T1"
when "1111" then "T1 + T2 + T3 + T4"
then you use the calc field as your filter.
Thanks for pitching in. I understand exactly what your saying, and in this situation a case statement might be the only way out. Problem is any future scalability will make this calculation exponentially big. So say I go down this route, is there a way I can work out a filter that only has the individual Treatments, where the multiple selections are somehow calculated in the background?
i.e Filter shows only 4 treatments but all possible combinations are calculated in the background based on the selections in the filter?
You could set up a series of individual parameters, one for each treatment, and let the users select (in-or-out) for each treatment.
See the attached workbook for an example of that. It was for a completely different sort of problem, but the principle is the same. Once you've stored what the user wants, you can filter for the proper string location being set to 1.
Here is a link to all the string calc functions:
You can use MID() to see if the appropriate position is set to 1. Filter on that.
LOOKUP question_VT.twbx 374.8 KB
So there would be only one calc in question, with as many lines as there are treatments.
IF [param1]="Y" and MID([matrix], 1,1) = "1" and
[param2]="Y" and MID([matrix], 2,1) = "1" and ...
then 1 else 0 end
Put that on the filter shelf, select for value = 1 and you'll get all records where the matrix value corresponds to the selected parameters.
If I were you, I would change the direction of the matrix code. Have the first position correspond to treatment 1, etc. That way, as you add new treatments, you won't have to rewrite the filter for treatments 1-4. (Right now, if the last position handles treatment 1, then you'll be using MID([matrix],4,1) to look at it, but when you add a new treatment you'll have to change that to position 5.) If you start at the left side, you can add treatments forever, and the parts of the filter already written will stay as is.
1 of 1 people found this helpful
And just one more followup: On the dashboard in the attached example, the parameters are laid out so that they use a slider for the on-off values, and the slider is so short that it operates with just one click.
The point of the question that generated this example was to get a filter-like behavior that turned on/off values with one click, like a multi-select filter where you select/deselect individual values.
The one feature of a multi-select filter we lose is the capability to select ALL with one click.
Had a chance to check it out this morning. All this works but not the way I'm looking to get it. You're right, in this case I'm asking Tableau to do something without all the pieces being in place. I found a way to make it work but not without restructuring the data table. Thank you for your help Joe, always greatly appreciated.