cancel
Showing results for 
Search instead for 
Did you mean: 

Minimum of 2 columns

Spd_03
Cosmonaut

Can we create a column which calculates minimum of 2 same columns but with different filter?
Consider Column_1 is having a filter Filter_1 and Column_2 is having a filter Filter_2, here both the columns are same but filters are different. Also filters are coming from Presentation Variables.

4 REPLIES 4

VenkateshP
Partner
Partner

Hi,

It is possible using min function and bring those 2 presentation variable filter based columns into formula builder itself.
For eg. using case formula you can apply the presentation variable based filter in the condition and bring the column1 and
similarly using another case formula you can apply the presentation variable based filter in the condition and bring the column2.
By applying min function for these 2 columns created in formula builder, you can get the desired result.

Scenario:
Eg:$PeriodName is Presentation variable in 'MM-YY' format i.e. '12-22' for Dec 2022
min(
sum(
case(
Test.psr_base_cost.period_name = $PeriodName,
sum(
Test.psr_base_cost.amount
),
0
)
),
sum(
case(
int(
'20' + substring(
$PeriodName,
find(
'-',
$PeriodName
) + 1
)
) = Test.psr_base_cost.period_year,
sum(
Test.psr_base_cost.amount
),
0
)
)
)

Above scenario, column1 is showing data for chosen 'Period Name' and Column2 is showing data for the 'year' wise.
'Test' is the schema name and 'psr_base_cost' is table name in above scenario.

Thanks
Venkatesh

Hi Venkatesh, Thank you so much!!

ZachBreimayer
Employee
Employee

What type of visualization are you wanting to use?

I want to achieve this scenario under Aggregated Table!!