'Power Automate - Selecting Max Value

I've made a flow which sends an email with a formatted table. The colour of cells change depending on a SharePoint item's field value (Low = Green, Med = Yellow etc):

enter image description here

In the above example the item has 4 fields: Low, Med, High and Highest. However this may not always be the case, an item may have 1 'Low' field, or may have 4 'Highest' fields or could have any combination in-between.

I want to include some text within the email which states the maximum value listed in the table (Highest being the max, Low being the min). In the above example the text should read 'Highest' as this is the max value, however this may not be the case for every item. I am not sure what logic would be required to define what the max value present is. Could anybody please assist?

This is what my flow currently looks like:

enter image description here

I use switches in order to set variables based off the SharePoint field value, then reference those variables in the email.

Any help would be appreciated.

EDIT: I think I need something which looks like this, but Flow is not accepting this expression

if((variables('Risk Level 1') or variables('Risk Level 2') or variables('Risk Level 3') or variables('Risk Level 4')), contains("Highest")), "Highest",
if((variables('Risk Level 1') or variables('Risk Level 2') or variables('Risk Level 3') or variables('Risk Level 4')), contains("High")), "High", 
if((variables('Risk Level 1') or variables('Risk Level 2') or variables('Risk Level 3') or variables('Risk Level 4')), contains("Med")), "Med", 
if((variables('Risk Level 1') or variables('Risk Level 2') or variables('Risk Level 3') or variables('Risk Level 4')), contains("Low")), "Low"))))


Solution 1:[1]

Here's my solution:

  1. Initialize Highest Risk Array

enter image description here

  1. After each Switch, append the relevant value to the Highest Risk Array

enter image description here

  1. Initialize Highest Risk String

enter image description here ?

If(contains(variables('Highest Risk Array'),'High risk, unmanaged, not tolerable.  Escalate to manager for review'), 'High risk, unmanaged, not tolerable.  Escalate to manager for review', 

If(contains(variables('Highest Risk Array'),'High risk - Managed & Accepted'), 'High risk - Managed & Accepted',

If(contains(variables('Highest Risk Array'),'Medium risk - Tolerable & Accepted'), 'Medium risk - Tolerable & Accepted',

If(contains(variables('Highest Risk Array'),'Low risk, Accepted'), 'Low risk, Accepted', 'False'))))
  1. Include Highest risk in email:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alexthannah