enter image description here

I am trying to do rule-based styling for active drilling rigs in the United States.

Basically, I want to have categorized styling (different colored dots) for all companies (field = "OpCompany") with greater than x active rigs.

For companies with less than x active rigs, I would like them all to be the same color dots.

It is important to note that the data set (picture attached) shows each rig individually, so I am trying to find a way to write an expression/ rule that counts the # of duplicate "Operator Company Name" values in the "Operator Company Name" field.

I have searched extensively online, however cannot find a solution to my problem. Any ideas here?

  • You just need to use rule-based styling. Here you can define the rules for each category and assign a symbol to each (pull down for categorized / graduated / rule-based) Jul 24, 2019 at 18:20
  • Thank you for your reply! How do I make the rule so that it counts the # of duplicate company names in the "OpCompany" field? (This represents the # of active rigs in my data set)
    – TGE
    Jul 24, 2019 at 18:43

1 Answer 1


First create two rules, one for companies with less than x rigs and other for companies with more than x rigs. here is an example with sn<25 and sn>=25. enter image description here. After this click the rule with greater and click Refine Selected Rules and click Add Categories to Rule.enter image description here. Then classify by the column name. Don't worry about having entries from other groups. Remove if you want. Final rules should be like this. enter image description here Apply.

  • I will give this a try. Thank you!
    – TGE
    Jul 24, 2019 at 18:45
  • How do I make the rule so that it counts the # of duplicate company names in the "OpCompany" field? (This represents the # of active rigs in my data set). The data set lists each rig separately. I will attach to the original post.
    – TGE
    Jul 24, 2019 at 18:55
  • use count or count_distinct function in expression builder while making rules.
    – neogeomat
    Jul 24, 2019 at 19:03
  • Can you provide an example of what the expression would look like in the expression builder given the picture attached above? The field name I am counting is "OpCompany".
    – TGE
    Jul 24, 2019 at 19:22
  • The sn>=25 rule shouldn't have its own symbology, otherwise it will hide the categorized symbols nested underneath.
    – csk
    Jul 24, 2019 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.