6 Replies Latest reply: Dec 20, 2017 4:59 AM by Anibal Martinez-Sistac RSS

    Change barplot color in generic dates dashboard

    Anibal Martinez-Sistac

      I am trying to change the color of one of the bars of my barplot without success. I am uploading a sample app to facilitate help from Qlik Sense comunity colleagues. It is well documented in this forum how to do it in more simple types of graphs (color by expression - QlikSense). It is done going to the "Appearance" tab, then clicking in "Colors and Legend", and changing the tab "Colors Custom" from "Auto" to "By Expression". Then in the "Fx" field entering: if(Date> '05.05.17' and Date< '13.05.17', Red(), Green()) for example. As below in my illustration:

       

      simple_color2.png

       

      Now, I have a more complicated chart where users enter dates through 6 variable extensions in the app ("BeforeMin", "BeforeMax", "DuringMin", "DuringMax", "AfterMin", and "AfterMax"). And a barplot with 3 periods is created: "Before", "During", "After". The dimension is created with the following expression:

       

      if((Date>=date(date#('$(vBDA_1)','DD.MM.YY'),'DD.MM.YY')) and

           (Date<=date(date#('$(vBDA_2)','DD.MM.YY'),'DD.MM.YY')), 'Before',

      if((Date>=date(date#('$(vBDA_3)','DD.MM.YY'),'DD.MM.YY')) and

           (Date<=date(date#('$(vBDA_4)','DD.MM.YY'),'DD.MM.YY')), 'During',

      if((Date>=date(date#('$(vBDA_5)','DD.MM.YY'),'DD.MM.YY')) and

           (Date<=date(date#('$(vBDA_6)','DD.MM.YY'),'DD.MM.YY')), 'After'

                  )

            )

      )

       

      The values I entered in each empty space of the Varaibles Extension boxes were:

      BeforeMin = 02.05.17

      BeforeMax = 03.05.17

      DuringMin = 04.05.17

      DuringMax = 05.05.17

      AfterMin = 06.05.17

      AfterMax = 07.05.17

       

      Resulting:

       

      imagen 1.png

       

      What I want is painting the bar of the middle (the one that receives the name "During") red, and the others green; but had no success. Have tried going to: >Appearance, >Colors, >By Expression; and entering;

       

      if((Date>=date(date#('$(vBDA_1)','DD.MM.YY'),'DD.MM.YY')) and

           (Date<=date(date#('$(vBDA_2)','DD.MM.YY'),'DD.MM.YY')),Green(),

      if((Date>=date(date#('$(vBDA_3)','DD.MM.YY'),'DD.MM.YY')) and

           (Date<=date(date#('$(vBDA_4)','DD.MM.YY'),'DD.MM.YY')),Red(),

      if((Date>=date(date#('$(vBDA_5)','DD.MM.YY'),'DD.MM.YY')) and

           (Date<=date(date#('$(vBDA_6)','DD.MM.YY'),'DD.MM.YY')),Green()

                  )

            )

      )

       

      But it gives error:

      uncolored.png

      Tried as well to asign the whole first chunk of code to "During" and then painting the bar red, else painting it green; but it also doesn´t work and shows the same grey chart above.

       

      I thank you very much if you could provide some help. Anibal.