cancel
Showing results for
Did you mean:
Post Prodigy

## How do I create a conditional colour rule in Charticulator?

Hi Everyone,

I am trying to create a conditional colour rule in Charticulator that says if the value is greater than zero 'green' and if it is less than zero, 'red'. I think I the only way to do this would be to create a measure that splits the values into two categories, positive and negative. I was just wondering if anyone knows if there is another way.

In the video I saw the person did the following but I can only assume 'value type' here is another category which categorises the categories based on there values. Essentially a measure. Any ideas?

Here is the full video:

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION
Super User

I may be over-simplifying this, but I'd have a measure like...

``colour = IF(["your measure"] > 0, "P", "N")``

That'll create a measure that's based on "your measure" which will be "P" of your measure is positive, or "N" if negative. Use that exactly like Ruth did in her video and you should be good.

Stuart

10 REPLIES 10
Post Prodigy

I managed to find the file that the author of the video used. She created a new calculated column to say if the value is greater than 0 then "p" if it's less than 0 then "n". Is there a way that you know of doing this by creating a measure? The author of the video told me there isn't but I'm mindful of the fact that new features are always being put in.

Super User

No, Ruth's right, in this case because she's graphing a column "Population change" you need a calculated column for positive or negative, so the column has one entry for each record.

If you're graphing a measure, then you can have a measure as the colour attribute, provided there is one colour attribute for each measure value.

You can use either columns or measures here, but you should be consistent, not mix columns and measures here.

Hope this helps

Stuart

Post Prodigy

Okay, in my case. I am mapping dates from a calendar table onto one axis and a measure on the other axis.The measure has values that are greater than zero for some months and less than zero for other months. How would you set one colour scheme for values greater than zero and another for values less than zero? can I do this using a measure?

Super User

I may be over-simplifying this, but I'd have a measure like...

``colour = IF(["your measure"] > 0, "P", "N")``

That'll create a measure that's based on "your measure" which will be "P" of your measure is positive, or "N" if negative. Use that exactly like Ruth did in her video and you should be good.

Stuart

Post Prodigy

Stuart! It worked like a charm, thanks alot. I created a measure using the IF statement you provided. I then dragged the measure into the line glyph's colour. Green for P and Red for N.

Super User

Great! glad I could help.

You may be interested in our blog, which has lots of charticulator information...

Charticulator - Burningsuit

and look out for our book on Charticulator, due to be published soon, which is a full reference to this brilliant tool.

Stuart

Post Prodigy

Yes I'll definitely take a look. Thanks. Out of curiosity are you a Microsoft or Charticulator stakeholder/employee?.

Super User

No, I run a Training company that specialises in Training on Power BI and associated topics like Charticulator. Other than being a user of their products I have no other link to Microsoft/Charticulator.

Stuart

Post Prodigy

Sounds cool either way. I'll be sure to note down this information. I posted another question online regarding Charticulator. Perhaps you may know the solution to this also. Please see below:

https://community.powerbi.com/t5/Service/Percentages-not-plotting-properly-on-Charticulator/m-p/2307...

Super User

Yes, as you worked out, you need a measure to drive the colour difference. In this example "value type" is a measure (P for positive N for negative) which goes into the "Fill" attribute to drive the different colours.

Hope this helps

Stuart

Announcements

#### Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

#### Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

#### What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

#### Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors