Finding maximum distribution between multiple columns

Another method is to add a new column, "Year Constructed," using a conditional expression like this:

Case 
 when "P1939" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 1939
 when "P1940" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 1940
 when "P1950" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 1950
 when "P1960" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 1960
 when "P1970" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 1970
 when "P1980" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 1980
 when "P1990" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 1990
 when "P2000" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 2000
 when "P2010" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010") then 2010
 else 0
end

Apply a categorized style using the new "Year Constructed" column.


Here's an alternative method using rule-based styling.

  1. Set up a graduated style with 9 classes with your desired color ramp. Choose the color ramp carefully, because if you want won't be able to change this later. It doesn't matter what field or expression you use for "column", because you're going to change that in step 3. The entire point of this step is to establish the color gradient.

    enter image description here

  2. Change the style from "graduated" to "rule-based." The 9 graduated classes will be automatically converted to rules.

  3. Change the label of the first rule to "Constructed in 1939", and change the filter expression to this:

    "P1939" = max("P1939", "P1940", "P1950", "P1960", "P1970", "P1980", "P1990", "P2000", "P2010")
    
  4. Repeat for all the rules, changing "P1939" to "P1940," "P1950," and so on.

    enter image description here

Note: There's no way to apply a color ramp to an existing set of rules. If you want to change the symbol colors later, you have to change the color for each rule, one at at a time.