1 Reply Latest reply: May 13, 2017 1:20 PM by Jay Fitchett RSS

    Qlik Sense - Sort table by Expression with Set Analysis

    Jay Fitchett

      Hi Folks,

      So I have a table with several dimensions and a measure that uses set analysis to ignore selections from 2 select dimensions (Dimension=). This works - when I select from those ignored dimensions the data in the table is not filtered. In this table I also sort using a custom expression using the Match function. My problem is that when I make a selection from one of the ignored dimensions, my custom sorting breaks, but it doesn't break completely - the data is still grouped  as defined by the match function but the groups are not in the correct order as defined by the Match function.


      Any thoughts on this behaviour? I'm using QlikSense 3.2

        • Re: Qlik Sense - Sort table by Expression with Set Analysis
          Jay Fitchett

          If anyone is wondering, I solved this problem by using a work around. The original expression I used for the sorting was


          Match([Risk_Data.Current_Risk_Level], 'Very High', 'High', 'Medium', 'Low')

          Instead of sorting by expression, I just added the value Risk_Weight to my source data in the load script ('Very High' = 1, 'High' = 2, etc) then sorted by the dimension.

          I've run into the same type of problem in the same table with the same dimension but now it's with a background colour expression:

          if([Risk_Data.Current_Risk_Level] = 'Very High', RGB(255, 45, 0),

            if([Risk_Data.Current_Risk_Level] = 'High', RGB(255,105,0),

              if([Risk_Data.Current_Risk_Level] = 'Medium', RGB(255, 237, 0),

          RGB(0, 178, 24))))


          When I select a value from an (ignored) dimension, only the risks, and therefore the risk level values, associated with the (ignored) dimension receive the proper colour - all others get the default value.


          I tried loading the colour values into my source data in the load script and updated my colour expression to RGB(R, G, B), but then I just got black colours for the risks that weren't associated with my selection. It's definitely something about how/when the expression is evaluated (before the set analysis is applied??) that is causing the problems.




          If anyone has any insights into the problem, feel free to share. I'm moving on and ignoring the colouring.