Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

expression help

I have a straight table with month as the dimension and 4 separate expressions.

Simply, I need to calculate in a separate text box but is the Maximum value in any month across those 4 expressions.

Is there anyway to do that without a very lengthy if statement?

I know how to calculate the maximum in each expression column separately, I'm just looking for an easy way to pick out the highest value.

Regards

Haider

1 Solution

Accepted Solutions
Not applicable
Author

I think I have just done it in the following way.

I put each expression in a variable

LET v_A =MAX(AGGR(SUM(column1),Month));

LET v_B=MAX(AGGR(SUM(column2),Month));

LET v_C=MAX(AGGR(SUM(column3),Month));

LET v_D=MAX(AGGR(SUM(column4),Month));

Then used the following expression

IF(v_A > (v_B AND v_C AND v_D), v_A,
IF(v_B > (v_A AND v_C AND v_D), v_B,
IF(v_C > (v_A AND v_B AND v_D), v_C,
IF(v_D > (v_A AND v_B AND v_C), v_D
))))

View solution in original post

2 Replies
ashfaq_haseeb
Champion III
Champion III

Hi Haider,

Can you post a sample data with expected output.

Regards

ASHFAQ

Not applicable
Author

I think I have just done it in the following way.

I put each expression in a variable

LET v_A =MAX(AGGR(SUM(column1),Month));

LET v_B=MAX(AGGR(SUM(column2),Month));

LET v_C=MAX(AGGR(SUM(column3),Month));

LET v_D=MAX(AGGR(SUM(column4),Month));

Then used the following expression

IF(v_A > (v_B AND v_C AND v_D), v_A,
IF(v_B > (v_A AND v_C AND v_D), v_B,
IF(v_C > (v_A AND v_B AND v_D), v_C,
IF(v_D > (v_A AND v_B AND v_C), v_D
))))