Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Colours in legend for the same dimension values

Hi All

I have a bar chart in which i'm comparing the current month data, to the previous month data using two expressions

and two dimensions

I have Legend as follows what i want

all the countries should have same colours in comparision with previous month

if one country is green in colour in current month it should be the same colour in previous month

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you have 18 or fewer countries you can add this background color expression to each expression:

=color(FieldIndex('Country', Country))

If you have more than 18 Country values you have to tweak the expression a bit like this:

=color(

  RangeMax(

  Mod(FieldIndex('Country', Country),18)

  ,1)

)

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

18 Replies
Anil_Babu_Samineni

Would you share the application or expressions

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

for current month   sum({$<MonthYear={"=$(=max(MonthYear))"}>}Value )

for previous month  sum({$<MonthYear={"$(=date(AddMonths(max(MonthYear),-1),'YYYYMM'))"}>}Value )

for pre previous month  sum({$<MonthYear={"$(=date(AddMonths(max(MonthYear),-2),'YYYYMM'))"}>}Value )

Top two values in current month comparing the same values with previous month

that is the thread where my application is and its name is 67.qvw

below iss the chart i japan is blue in colour in 2016 06 then it should be blue in colour in the previous month as well

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you have 18 or fewer countries you can add this background color expression to each expression:

=color(FieldIndex('Country', Country))

If you have more than 18 Country values you have to tweak the expression a bit like this:

=color(

  RangeMax(

  Mod(FieldIndex('Country', Country),18)

  ,1)

)

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Not applicable
Author

Hi Rob

Thank god, i'm a very excited that you replied to me, i regularly follow your posts,

I have been struck in a an issue since the last 1 month

But the expression you provided is not working for me

i'm looking for something like this

fro three different countries three colours and and the same country in the previous month have the same colour as the current month

HirisH_V7
Master
Master

As Rob Mentioned,

use the expression -> Back Ground Expression ->

Color Match for same ID-237764.PNG

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

hi can u please atatch the sample qvw i tried it but not working

Not applicable
Author

i'm getiing a unique colour i want a different colour for differt values

HirisH_V7
Master
Master

Hi,

do u need same color for every country,For every month right!!!

Check this,

PFA

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

yes