Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Qlik Cloud Maintenance is scheduled between March 27-30. Visit Qlik Cloud Status page for more details.
Showing results for 
Search instead for 
Did you mean: 
Not applicable

color by expression - QlikSense

Hi all,

i am struggeling with a simple line chart. It shows revenue over month - so "Month" would be one dimension. It has two expressions. The one calculates revenue for the current year. The other calculates revenue for the previous year. All no problem.

What i want - and until now couldnt get to: I want the line representing the current year to have a specific color (lets say, red) and the line representing the previous year to have another specific color (lets say, gray).

Can anyone help and explain how this can be done in SENSE ?



45 Replies
Contributor III
Contributor III

I read all this long thread. Powerless, I chose for a google search with recent results, and I found the right thread.

Color scheme in qliksense for bar chart

That works well for me. If you believe that is the correct answer to this thread, please mark this reply as the solution, and we can help newcomers from reading all this thread.

Creator II
Creator II

Hi Philipp,

In Qlik Sense new release provide this type of functionality to give a specific color to the specific measure.

Please see my answer in below link for more detail.

Hope this will help.

Creator II
Creator II

Hi Philipp,

In the New version of the Qlik Sense ( i.e 3.2 SR1), it is possible to give a specific color to the multiple expressions (Measures).

I've given a different color in example attached by you in this blog and below is the resulting image.


To give a specific color to measure follow below steps:

1. Make Expression as Master Item (Measures).

2. In Master Item (Measures) Choose Specific Color for that expression.

3.Apply that Master Item Measure directly into Chart Measures.

Below are the Images for the Master Item Setting.

Master Item.PNG

Master Item Detail.PNG

Now use this Master Measure Item in Your Measure.

Contributor II
Contributor II

Hey steve this solution worked for me, thank you so much. I have one more functionality to be implemented on top of this. On selection of any month (i have Date instead of month dimension) I have to display data from 2  previous months along with selected month. For Example on the selection of July month, it should show data of May ,June and July.

I have to show data of all dates of this three month on selection of anydate from July. How can we do that?

I tried this

if(  ValueList('Dim1', 'Dim2', 'Dim3', 'Dim4')='Dim1', SUM({<Date = {"$(='>=' & Date(AddMonths(BusinessDate, -2)) & '<=' & Date(BusinessDate))"},Year={2011}>}Sales),

if(  ValueList('Dim1', 'Dim2', 'Dim3', 'Dim4')='Dim2', SUM({<Date = {"$(='>=' & Date(AddMonths(BusinessDate, -2)) & '<=' & Date(BusinessDate))"},Year={2012}>}Sales),

if(  ValueList('Dim1', 'Dim2', 'Dim3', 'Dim4')='Dim3', SUM({<Date = {"$(='>=' & Date(AddMonths(BusinessDate, -2)) & '<=' & Date(BusinessDate))"},Year={2013}>}Sales),

if(  ValueList('Dim1', 'Dim2', 'Dim3', 'Dim4')='Dim4', SUM({<Date = {"$(='>=' & Date(AddMonths(BusinessDate, -2)) & '<=' & Date(BusinessDate))"},Year={2014}>}Sales)


PS: currently on selecting any date data is coming for one date only



You should look at Set Analysis to achieve this. Using the date dimensions generated by the data preparation of the Data Manager you would have something similar to SUM({$<MonthsAgo={0,1,2}>} Measure1)

Please note that this thread is very old now and recent editions of Qlik Sense allow you to colour each measure separately by defining it in the master library.

Creating a master measure from a field ‒ Qlik Sense


Hi Philipp,

we have a direct option in sense. add both expressions to master measures there you can select the specific color for each measure.