16 Replies Latest reply: Feb 21, 2017 2:47 PM by Darry Winston RSS

    Variable Creation

    Darry Winston

      I am trying to create a variable. I would like to take this bar chart and fade from dark to light with a blue color. I work for Michelin so preferably Michelin blue. Any suggestions?

       

        • Re: Variable Creation
          Gysbert Wassenaar

          One way is to use the colormix1 function. You can use the Colormix wizard in Qlikview to generate something like this:

           

          ColorMix1 ((1+Sign(2*(sum(Sales)-RangeMin (top(total sum(Sales),1,NoOfRows(total))))/(RangeMax (top(total sum(Sales),1,NoOfRows(total)))-RangeMin (top(total sum(Sales),1,NoOfRows(total))))-1)*Sqrt(Fabs((2*(sum(Sales)-RangeMin (top(total sum(Sales),1,NoOfRows(total))))/(RangeMax (top(total sum(Sales),1,NoOfRows(total)))-RangeMin (top(total sum(Sales),1,NoOfRows(total))))-1))))/2, ARGB(255, 211, 235, 254), ARGB(255, 0, 0, 255))

           

          Replace sum(Sales) everywhere with the expression of your measure.

           

          Or you can try the HSL function and tweak it until you like what you see:

          HSL(0.6,0.5,0.35 + 0.5*(rank(sum(Sales))/ NoOfRows(total)))

          • Re: Variable Creation
            Jessica Waldrop

            I had a similar situation with specific brand colors, that needed to be assigned to particular dimensions.  I created color variables loaded from an EXCEL sheet to house these colors and then created my own dimensions and variables for the bar chart.

             

            //Create your Dimensions

            =VALUELIST(‘Dimension1’, ‘Dimension2’, ‘Dimension3’, ‘Dimension4’)

             

            //Add your measure

              ( PICK(

                      MATCH(

                                 VALUELIST( ‘Dimension1’, ‘Dimension2’, ‘Dimension3’, ‘Dimension4’),

                              ’Dimension1’, ’Dimension2, ’Dimension3’,’Dimension4’

                            ),

                  NUM(SUM(Dimension1_Value), ‘#,##0’),

                  NUM(SUM(Dimension2_Value), ‘#,##0’),

                  NUM(SUM(Dimension3_Value), ‘#,##0’),

                  NUM(SUM(Dimension4_Value), ‘#,##0’)

                      )

              )

             

            //add Color Expression

              ( PICK(

                      MATCH(

                                 VALUELIST( ‘Dimension1’, ‘Dimension2’, ‘Dimension3’, ‘Dimension4’),

                              ’Dimension1’, ’Dimension2, ’Dimension3’,’Dimension4’

                            ),

                 $(cPrimary_Blue100),

                 $(cPrimary_Blue75),

                 $(cPrimary_Blue55),

                 $(cPrimary_Blue40)

                      )

              )

            • Re: Variable Creation
              Michael Tarallo

              Hi Darry -

               

              You would do as Gysbert stated in the chart property under color and legend and choose expression and make sure the check box for expression is a color code is selected. There is a video here in case you want to see it in action: Qlik Sense in 60 - Color by Expression - YouTube

               

               

              Let us know how you do.

               

              When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

               

              Regards,

              Mike Tarallo

              Qlik

              • Re: Variable Creation
                Darry Winston

                Thanks everyone for the feedback... Greatly appreciated. I will give these suggestions a shot. Thanks again!!