Add the comma to SCE. Rewrite your calc like this:
case [Choose Program]
when 'ALL' then ""
when 'SCE' then "sce,"
when 'SCG' then "scg"
when 'PGE' then "pge"
when 'SCEIP' then "sceip"
Hi shawn-- I thought about that, but it will still fail in the event that there is a record that only participated in SCE, since program_combination for that record would just contain "sce" and would not have the comma. I've updated the example file with that case to illustrate.
At the end of the day, I think that unless I can rename the programs somehow in my source data so that they are all unique in some way, I can't continue to use the filter for a specific string. So perhaps I need to find another way to have a parameter filter on each of the program booleans. So for example, if SCE is selected as a parameter, then pass a "1" into the SCE field filter and "0" into the filters for all of the other booleans for the other programs. But I can't figure out how to do that, exactly.
Use the LEN function to test how long the string is first. Then branch accordingly.
I'm not quite sure I follow. Are you saying use that when I filter by program_combination, or use that to create different versions of strings that are passed into the filter?
Daniel, I was being lazy and didn't take the time to work it all out for you. I'm certain this can be done without reworking your data, but it will need to wait until tomorrow. I'll post a workbook for you first thing in the morning.
Awesome! Thanks so much!
OK, it's a little funky, but I'm pretty sure it works the way you want. Here's the meat of it:
[Choose Program]='ALL' OR
AND NOT CONTAINS([program_combinations],
IF [Choose Program]='SCE' THEN 'sceip' ELSE '@' END )
That @ symbol can be any character that is NOT included in the string. File attached.
1 of 1 people found this helpful
That worked! Thanks a ton. I had also filed a support request with Tableau directly, and I just heard back. This was their suggested solution:
case [Choose Program]
when 'ALL' then "show"
when 'SCE' then If contains([program_combinations],"sce") and [sce]=1 then "show" else "hide" end
when 'SCG' then If contains([program_combinations],"scg") then "show" else "hide" end
when 'PGE' then If contains([program_combinations],"pge") then "show" else "hide" end
when 'SCEIP' then If contains([program_combinations],"sceip") then "show" else "hide" end
Then place this field on the Filters shelf and select "Show".
This will prevent the confusion between SCEIP and SCE.
Sounds like the long way around, but they were trying to respect your original MAX calc thingy so their solution does look like it will work. I just think you were doing needless contortions because you didn't fully understand how filters work.
But of course if it works, go for it!
Partly because of your comment here YOY YTD Bar Chart which I read this morning, this is just a note to say I've just used this solution and found it fitted the bill perfectly!
Thank you v much.