5 Replies Latest reply: Aug 24, 2017 12:02 PM by Eva Lesny RSS

    Help With Colourmix1 Expression

    Alison Cooke

      Hello everyone,


      I have a colourmix expression that looks like so:


      Colormix1(sum($(vExpenditureAmount))-$(=min(aggr(sum($(vExpenditureAmount)), [Expense Category]))))/$(=(max(aggr(sum($(vExpenditureAmount)), [Expense Category]))-min(aggr(sum($(vExpenditureAmount)), [Expense Category])))),white(), $(vDenim))


      The variable, vExpenditureAmount, looks like so:


      sum([Session Transaction Fee]) +

      sum([Merchandise Shipping Fee Charged]) +

      sum([Institutional Transaction Fee]) +

      sum([Institutional Transaction Fee]) +

      sum([University Transaction Fee]) +

      sum([Marketing Cost]) +

      sum([Admin Expense]) +

      sum([Operation Cost]) +

      sum([Misc. Cost]) +

      sum([IT Expenses Cost]) +

      sum([IT Investment Total]) +

      sum([Salary Total]) +

      sum([CP Total])


      When writing the colourmix1 expression I am given no error message and when I press apply, my piechart remains grey.


      What is it that I am doing wrong?


      Thank you in advance,


        • Re: Help With Colourmix1 Expression
          Eva Lesny

          I assume that the formula you use gives a "wrong" result. Colormix expects a value between 0 and 1.

          Colormix1 (Value , ColorZero , ColorOne)

          "Value" needs to be a real number between 0 and 1.


          How does your vDenim look like? It could also be that that one is not correct and therefore Qlik doesn't know what colour to use.

            • Re: Help With Colourmix1 Expression
              Alison Cooke

              Hello Eva,


              Thank you for your response.

              Sorry, I am unsure of what you mean by my formula giving a 'wrong' result.


              vDemin looks like this:

              RGB(21, 96, 189)

              I'm pretty sure there's no issue with that as I've used it in other visualisations without complaint.

                • Re: Help With Colourmix1 Expression
                  Eva Lesny

                  The calculation you are using:

                  sum($(vExpenditureAmount))-$(=min(aggr(sum($(vExpenditureAmount)), [Expense Category]))))/$(=(max(aggr(sum($(vExpenditureAmount)), [Expense Category]))-min(aggr(sum($(vExpenditureAmount)), [Expense Category]))))

                  needs to between 0 and 1. If it is 2 it cannot be coloured.

                  I made a dummy table:

                  2017-08-24 17_43_51-Qlik Sense Desktop.png



                  I used this to colour the column

                  ColorMix1(if(wildmatch(City, 'Bern'),2, if(wildmatch(City, 'Berlin'),0,1)), blue(), red())

                  The number is calculated using the same formula.

                  If the city is Bern, assign it the value 2, if it's Berlin the value 0 and everything else gets the value 1

                  As you can see, it correctly colours "1" with red, and "0" with blue. The "2" is not coloured though, and I didn't get an error in my formula (as Qlik doesn't know it can contain numbers bigger than 1)