8 Replies Latest reply: Jun 16, 2016 11:34 AM by ZHONGHONG TU RSS

    Filter Pane - IF Statement doesn't work there


      Hi guys,


      If you could give me some advise here, I would be very appreciated - why IF statement doesn't work in filter pane?


      I have a table with 2 columns - "Data_Tab_Elements" and "Data_Strata".


      I'd like to show "Data_Strata" ('a','b','c','d') in filter pane, ONLY when "Data_Tab_Elements" is 'Category'. However, whenever I included IF statement in Filter Pane, it doesn't work. Qlik would not recognize the selection (Showed in "GetSelectedCount(Data_Strata)" as below:)

      I create an app to show the differences between without IF vs. with IF.

      without IF: Data_Strata


      with IF: If (Data_Tab_Elements = 'Category',Data_Strata)


      To my best knowledge, Filter Pane is set as "DIMENSION", which should allow to use IF statement. 


      Any helps would be greatly appreciated!


      Thanks in advance!

        • Re: Filter Pane - IF Statement doesn't work there
          Stefan Wühl

          Try a filter pane field expression like


          =Aggr(If (Data_Tab_Elements = 'Category',Data_Strata),Data_Strata)

            • Re: Filter Pane - IF Statement doesn't work there
              ZHONGHONG TU

              Thanks Swuehl! I

              have tried your solution. This solution absolutely resolved the problem "IF Statement doesn't work in filter pane." However, it also brings me couple of concerns towards this solution:

              1. Please feel free to correct me if I'm wrong. But to my best knowledge, the Aggr() function would create a "virtual table" that has the .rows with "Data_Tab_Elements" = 'Category', and Join back on the actual source table. This would have more obvious impacts on the performance of the app with the growth of datasets (ex. I do have mass rows in production environment).
              2. As the Join results, it would only show one selection after one value is selected (only show that value). We won't be able to do multiple chooses on values.