Sum of unique amounts per dimension with the condition

Hi all,

I have a table with the balances per account and data type. The balances might be repeated for the same dates

I need to create a table with the data_type, balance_date field and the calculation of the balance of the first available date per data set:

I’ve almost finalised the expression, but it calculates the higher sums due to the double balance bookings for the same date

sumOver(

sum(ifelse({balance_date}=minOver({balance_date}, [{data_type}], PRE_AGG), {balance_amount}*rate, NULL)), [{data_type}]

)

The dataset can be checked below:

test first balances

Many thanks for your help

The expected calculation is shown in the last column:

This should work for first total balance calculated field

Many thanks! This works