Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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?

1 Solution

Accepted Solutions
sunny_talwar

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

View solution in original post

3 Replies
sunny_talwar

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

Not applicable
Author

Sunny,

Thanks again.  This worked.

sunny_talwar

Awesome!