Hello, I have 3 different filter/slicers having their own categories and two date ranges(Min and Max). I am trying to build a SWITCH statement that will redirect the user to other external sites as filter query feed based on the combination of filters selected. But my concern is because there are 5 filters, there will 5! combinations(i.e 25 )
like when all 5 selected, (when 4 selected and 1 unselected(blank)), (when 3 selected and 2 unselected (blank)),…
so my statement starts
Result 1 =
VAR SELECTION1 =SELECTEDVALUE(FILTER1)
VAR SELECTION2=SELECTEDVALUE(FILTER2)
VAR SELECTION3=SELECTEDVALUE(FILTER3)
VAR SELECTION4=SELECTEDVALUE(FILTER4)
VAR SELECTION5 =SELECTEDVALUE(FILTER5)
SWITCH( TRUE(),
IF (NOT(ISBLANK(SELECTION1)&& ISBLANK(SELECTION2)&&ISBLANK(SELECTION3)&& ISBLANK(SELECTION4)&&ISBLANK(SELECTION5)),[SITE1],
…
… up to different combinations.i.e [SITE1],[SITE2],… are predefined measure for d/t site links based on d/t combination of user selection.
I feel this isn’t the best approach.
Therefore I am trying to get your ideas and clues on how to approach this one.
Thanks a lot!
Have you considered using the selection as part of the URL itself? This may help you reduce the number of cases required or eliminate the need for the switch.
A selection as part of the URL itself is the approach I followed, but the URL string varies as per the type and number of selection and there are constant string i must in the URL definition, so I can not use a single URL string definition, and there is no way I can remove “no selection” from the URL string
if I use the same generic URL.
If all selected : varURL = “http://www.somesite/” & “string-x” & varSelection1 & “string-y” & “/” & varSelection2,…-------This works fine however
If say two filters selected and one other filter is not selected: this scenario breaks the URL, as there is no way I can remove the constant string even if I default the “selected value” to the unselected filter tobe blank().