3 Replies Latest reply: Apr 22, 2015 2:50 PM by Sunny Talwar

# Sum Function using two different variables

I'm attempting to use the Sum function apply two variables to arrive at an aggregated total.  I have created the following expression that will work correctly for the Max Date (12/31/2014)

=Sum({\$<[BROKER]={'BLKR'},[BS Date]={"\$(=Date(Max([BS Date]),'MM/DD/YYYY'))"}>}[BALANCE])

However, I need to aggregate a total based on dates from the previous two months (i.e. 11/28/2014 & 10/31/2014) using the following expressiosn:

=Sum({\$<[BROKER]={'BLKR'},[BS Date]={\$Date={'10/31/2014'},'MM/DD/YYYY'"}>}[BALANCE])

=Sum({\$<[BROKER]={'BLKR'},[BS Date]={\$Date={'11/28/2014'},'MM/DD/YYYY'"}>}[BALANCE])

Does anyone have an idea on how to solve for this?

• ###### Re: Sum Function using two different variables

Not sure what exactly you are trying to do, but try this:

=Sum({\$<[BROKER]={'BLKR'},[BS Date]={'10/31/2014', '11/28/2014'}>}[BALANCE])

This expression would sum up BALANCE for the two given dates (10/31/2014 and 11/28/2014) and where BROKER = BLKR

HTH

Best,

Sunny

• ###### Re: Sum Function using two different variables

Sunny,

Thanks again.  This worked.

• ###### Re: Sum Function using two different variables

Awesome!