How To Get Min of More Than 2 Values

Cory Fifield -

Trouble viewing images? Click on images to enlarge.

 

 

The Problem: I am trying to find the MIN of more than 2 fields and I cannot figure out how to do it in Finished Reports.

 

Example: Min([calculatedField1],[calculatedField2],[calculatedField3])

 

 

The Solution: Creating A Nested Min

Min(Value1, Value2) - Returns the minimum value from the specified values.

 

Since the Min() function only accepts two values, creating Nested Mins will give you a work around that allows you to use more than two values.

 

Solution Example: Min(Min([calculatedField1],[calculatedField2]),[calculatedField3])

 

If you would like to download an example View to follow/preview, one is available here.

Sample View - Download

 

Creating A Nested Min

 

1. Open VDM and the View you need to modify.

 

 

2. Run the View

 

 

3. Go into Finished Reports Designer and verify all fields in the calculation are decimal datatype.

mceclip0.png

 

 

4. Create expression/calculated field to get the Min.

mceclip1.png

 

 

Optional: If you want to add more values you would follow the same structure.

Min of 2 Values: Min([calculatedField1],[calculatedField2])
Min of 3 Values: Min(Min([calculatedField1],[calculatedField2]),[calculatedField3])
Min of 4 Values: Min(Min(Min([calculatedField1],[calculatedField2]),[calculatedField3]),[calculatedField4])

 

 

 

Have more questions? Submit a request

Comments