I’m afraid it’s not possible to use variables in an analysis filter.
This is because the Analysis filter effects the data available to be displayed in the analysis. If you were to change the subprocess defined by ‘to’ and ‘from’ to a more common one, those extra cases couldn’t just be included (like they are with sheet filters) because the cases aren’t available to the analysis, as they haven’t been loaded. The whole analysis needs to be reloaded, to include more cases. To avoid these problems the analysis throws up an error. I presume ‘to’ and ‘from’ can be set by viewers using a button. In such cases it’s better to use sheet filters anyway so the viewers can easily how many cases they are excluding. If you don’t want viewers to adjust the filter, I’d just hard code the filter by just writing the activity names as text into the filter.
If you use an analysis filter, or the same sheet filters on all sheets, its generally a good idea to add a text component explaining which filter is active to prevent confusion.
Also as an alternative to Process Equals, you could use MATCH_PROCESS_REGEX() if you wanted as it is more flexible.
The sheet filters would then be:
FILTER MATCH_PROCESS_REGEX(<%= from %> >> (ANY)* >> <%= to %>) = 1;
‘>>’ means directly followed by
‘(ANY)*’ means any number of activities (including 0) can come between ‘from’ and ‘to’.
MATCH_PROCESS_REGEX() returns a 1 for cases with the specified process path, so together with ‘= 1’ it builds a logical condition for use in the filter.
In case you want to enable more flexible settings such as multiple possible ‘from’ activities, this can also be achieved with this function so its worth reading up the help pages.
Does this answer your question.