Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Set colours

Hello everyone,

I'm trying to fix some colour due o the name of the field and i found out that i have a problem.

I've created a group with 3 drill-down possibles.

then i added the group in the dimension.

Lets says that,

Group have, name of customer, region, age.

Then in the backgroud colour, i've set up:

if ( Region='Lisbon', rgb (10, 120, 130), if (Region='Porto', rgb (10, 200, 40))

Its works perfectly for Lisbon and Porto.

My problem is when the Dimension of the Group is the first one or the thir one, customer or age, it gives one colour to all customers or ages.

Theres any solution without having to set up if (age=x, rgb () , if (customer=y , rgb ( ) ) ?

Theres any command that we could right if ( region = lisboa , rgb (10, 20, 30 ), All rgb possibles) ?

Best Regards,

Eliano

Tags (3)
1 Solution

Accepted Solutions
MVP
MVP

Set colours

Hi Eliano,

If I understand what you are asking correctly you should be able to achieve what you are after by using GetCurrentField([Drill Group]) on your Drill dimension and embedding that into your colour expression.

You will end up with quite a chunky expression with a number of nested if, just be careful with brackets and put in carriage returns to make the code readable.

If I have missed the point please post back and provide further details.

Good luck!

Steve

10 Replies
dennisnet
Valued Contributor III

Set colours

Hi Eliano,

Just to be sure, how do you want your colours to change?
What should the result be?

MVP
MVP

Set colours

Hi Eliano,

If I understand what you are asking correctly you should be able to achieve what you are after by using GetCurrentField([Drill Group]) on your Drill dimension and embedding that into your colour expression.

You will end up with quite a chunky expression with a number of nested if, just be careful with brackets and put in carriage returns to make the code readable.

If I have missed the point please post back and provide further details.

Good luck!

Steve

Not applicable

Set colours

Steve,

I tried what u suggest but didnt work.

I'll try to explain my problem in a different way:

I have a group with 3 dimension

Dimension 1 - Customer;

Dimension 2 - Region;

Dimension 3 - Variable 3

Imagine that i program Sum (sales ) in the expression.

In the background colour i program: if ( region='Lisbon'; rgb (0,0,0) , if (region='Porto', rgb (1,1,1) )).

Then Lisbon and Porto have a pre-selected colour.

But when i pre-select that colour to the regions name, automatically it give a fix colour to all customer names and variable 3 names.

What i want is to right a syntax that says something like that:

If is a region name than the colour will be pre-selected, but if is a customer name it gives mix colours automacally.

What i didnt want to do is this:

if ( region='Lisbon'; rgb (0,0,0) , if (region='Porto', rgb (1,1,1) , if ( customer=a, rgb (2, 2, 2 ) ).

What i would like is:

if ( region='Lisbon'; rgb (0,0,0) , if (region='Porto', rgb (1,1,1) , Mix colour for customer and variables 3 ).

Can u help me with that?

Best regards,

Eliano Marques



MVP
MVP

Set colours

Hi Eliano,

I am not quite following what it is you are trying to achieve. Could you produce an example .qvw and upload it for me to look at?

Regards,
Steve

Not applicable

Set colours

Steve,

Thanks for the support.

I had add a file in qvw..

Hope this time you can understand my problem.

Best regards,

Eliano

MVP
MVP

Set colours

Hi Eliano,

The reason that you can not have multicoloured bars for dimensions 1 and 2 is that you have a combo chart with more than one dimension. Where this is the case QlikView uses one colour for the first dimension and another for the second.

You could remove the line from the chart and set the default colour (ie. when no region is matched) to null() and you would be able to tick Multicolored on the Colors tab and all would be as you wish.

With the combo chart though it is a little trickier, but I think you can achieve what you want by using the colour function. This allows you to reference the colours from the palette in code. As both the Ano and Med dimensions are numeric you can use this to your advantage to mix up the colours. Simply replace the default colour with the following:

color(if(GetPossibleCount(Ano) > 1, (Ano - 2000), max(id_mes) ) )

I've attached your document with the colour function amended accordingly.

Incidentally, as a rule of thumb I tend not to use multi coloured bars on bar charts unless there is a specific reason to do so.

Also, the data model in your document doesn't seem particularly well optimised. I would suggest reading up on data design best practice (I did a blog post entitled 'Getting the best performance from QlikView' - for instance) as this could save you from problems down the line.

All the best,

Steve

Not applicable

Set colours

Thanks a lot Steve.

MVP
MVP

Set colours

No problems, glad to be of assistance.

-Steve

Not applicable

Set colours

Steve,

Sorry to bother again, but i need i litle help.

Im making a report about a questionnaire.

The database is filed like that:

Id , Question 1-A, question 1-B, question 1-C, question 1-D

1, A, B, C , D

2, B, A, C, D

3, D, A, C, E

...

400, D, A, B, A

Then i want to make a table or a grah like this:

Rows\Columns A B C D E Total

Question 1-A 30% 20% 10% 5% 35% 400

Question 1-B

Question 1-C

Question 1-D

I tryied in the dimension to Aggregate (question 1-A, Question 1-B, Question 1-C, Question 1-D)

Then i wrote in the 1st expression i count(Question 1-A ) ;

2nd expression count (question 1-b), etc.

The result isn't i pretend because it doesnt give me all the answers that is possible.

I attacht i file to see if u could help me.

Thanks a lot,

Eliano Marques

Community Browser