Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
chetansehgal
Creator
Creator

how to change colors of measures in barchart

Hi,

In Qlik Sense, I have a bar chart in which i have one dimension and two measures. I want to give colors of my choice for each measure.

Also i am using a valuelist function to generate dimension values.

Please suggest .

It was very easy to achieve the same in QlikView, but seems its not directly possile in Sense.

Thanks

1 Solution

Accepted Solutions
shraddha_g
Partner - Master III
Partner - Master III

I guess I got your problem,

Uncheck show zero values from Addons section.

PFA

View solution in original post

13 Replies
robert_mika
Master III
Master III

shraddha_g
Partner - Master III
Partner - Master III

Use valuelist() for Measures also.

And in color by expression use same valuelist to give color of your choice

rittermd
Master
Master

I just did this yesterday.

Set up an additional dimension based on ValueList of your choices.

ValueList('Start of Care','End of Care')

Then use the same ValueList in your Measure Expression.

if(ValueList('Start of Care','End of Care')='Start of Care'

  ,Avg(MeasureValueStart)

  ,if(ValueList('Start of Care','End of Care')='End of Care'

     ,Avg(MeasureValueEnd))

         

  )

Then set color to expression and use something like this:

if(ValueList('Start of Care','End of Care')='Start of Care',rgb(245,122,43),rgb(252,175,24)  )

chetansehgal
Creator
Creator
Author

Hi Mark,

I tried this earlier but the problem is I am using MonthYear in the Dimension and want to see only last 6 month bars.

I am using below expression in the measure.

Count({<Date={">=$(=addmonths(max(Date),-6))"}>} DISTINCT Loan_Ref_No)

When i am using your approach, it shows all the 12 months and 6 months has not data.

I have unchecked the "Show null values". Thesre is no option to suppress 0 .

Please suggest.

Thanks,

Chetan Sehgal

shraddha_g
Partner - Master III
Partner - Master III

Hi Chetann,

Suggestion given by Mark works perfectly. Because I always use this approach.

when you are using valuelist(), what is the exression you are using in chart?

chetansehgal
Creator
Creator
Author

Hi Shraddha,

The solution works fine. But i am getting addition problem . I want 6 months data only for which i have written set exprssion in measure and it works if i am using only one dimension i.e month. If i add valuelist as new dimension, immediately 6 empty months are getting added in chart.

Thanks,

Chetan

shraddha_g
Partner - Master III
Partner - Master III

can you share your sample.

because it works with timeline in my case

chetansehgal
Creator
Creator
Author

Dimension: Month Year (Sep 2016, Aug 2016......)

Expression 1 :  Sum(Sales)

Expression  2:  Sum(Discount)

I want only last 6 month bars in the chart.

i.e  if i have data upto Sep 2016, then it should show Sep 2016,Aug2016,Jul 2016,Jun 2016, May 2016, Apr 2016

I dont have MonthNumber as any field in data and i cant change data as well.

I am using Date={">=$(=addmonths(max(Date),-6))"}  in both the expressions to show 6 months only.



shraddha_g
Partner - Master III
Partner - Master III

Then it will be

Dimension 1 : Month Year (Sep 2016, Aug 2016......)

Dimension 2: Valuelist('Sales','Discount')

Measure:

pick(Wildmatch(Valuelist('Sales','Discount'),'Sales','Discount'),

Sum({<Date={">=$(=addmonths(max(Date),-6))"}>}Sales),

Sum({<Date={">=$(=addmonths(max(Date),-6))"}>}Discount)

)

Color by expression:

pick(Wildmatch(Valuelist('Sales','Discount'),'Sales','Discount'),

red(),

green()

)

(Change colors according to your requirement)

Let me know whether it works