Let's say you have fields A, B, C, and D, each of which hold District information. There are a lot of ways, concatenation, fancy parameters, etc. with which to do this. I think the easiest is:
I'm sorry, I don't follow you... how would a calculation like this allow the user to select district and school?
As you described it (unless I misunderstood), the problem is that the data is messy. As a result, the district is in a number of fields. Going with my earlier example - it could be in field A, B, C, or D. If you give users a filter on field A where they could select their District, this is perfect... for users whose district is in the A field. But if the user's district is in any of the other fields, they would have to select Null. And this Null selection would include multiple districts. So the first step is to combine the fields.
Make a list of all of the fields which hold the district value, then put them in the syntax I described in my original response. Now use that field as a filter. It should now be a "District Master" field. You can do the same thing with each of the fields which hold the school value.
Just use each field as a filter, and they should be able to select the appropriate values. You can also select the dropdown on the School filter and select "Only Relevant Values". This will ensure that once the user has selected a district, only the corresponding school values appear in the School filter.
Did I understand that correctly?
Thanks Ben, I see what you're getting at... but to clarify: the districts are not in fields, but rather constitute fields, within which each case will either have the name of the school within that district, or a null if the school for that case is in another district, and thus in another field. So I need a way to first filter for the field (district) and then once that is selected, filter for the school within that field (district).
As it stands, I created a calculated field per your syntax, but Tableau crashes when I try to put it into a filter...
Aaaaah... that's clearer. You're honestly going to be best served here by pivoting the data.
The only other way I can think of to do this is to create a parameter which has all of the districts as values. Based on which option the user selects, you look up the corresponding column. But you will have to write out a line for every district, which could be quite tedious... i.e.
If [Parameter] = "Carlsbad Unified" THEN [Carlsbad Unified]
Then you would place this field as a filter. But again... tedious, and won't scale well, or at all to new districts. Pivoting is a much better option if you can.
Thanks, Ben. Agreed, data needs to pivot, but the parameter within the filter works for now, even if a bit kludgy.