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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
asmithids
Partner - Creator II
Partner - Creator II

Set Analysis Expression For Balance Sheet Accounts

Hello,

I have the following expression for YTD sum.  The issue is that I need to sum account transactions from the beginning of time to the current Year-Month selection for a Balance Sheet report.  Balance Sheets are an accumulating financial report that maintains a running total from the beginning of time.  I'm not sure how to alter the expression below to start the summation from the beginning of time (i.e. 2007) up to and including the Year-Month selection.  

Thank you in advance for assistance with this question.   

Sum({$<Year={$(=Max(Year))},Month={"<=$(=Max(Month))"}>}TransactionAmount))

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think it would be easier to create a field containg the Year-Month, i.e. the Monthstart date showing unique values for every combination of Year and Month (I assume Year and Month fields have a numeric representation in your data model):

In your load script, something like this:

LOAD

     Year,

     Month,

     Makedate(Year, Month) as MonthStart

FROM ...

Then:

Sum({$<Year=, Month=, MonthStart = {"<=$(=Max(MonthStart))"}>} TransactionAmount))

View solution in original post

4 Replies
swuehl
MVP
MVP

I think it would be easier to create a field containg the Year-Month, i.e. the Monthstart date showing unique values for every combination of Year and Month (I assume Year and Month fields have a numeric representation in your data model):

In your load script, something like this:

LOAD

     Year,

     Month,

     Makedate(Year, Month) as MonthStart

FROM ...

Then:

Sum({$<Year=, Month=, MonthStart = {"<=$(=Max(MonthStart))"}>} TransactionAmount))

Anonymous
Not applicable

My 2 cents...  actually only 1 cent:

Set analysis is "format-sensitive".  In the example from Stefan the MonthStart field is in the date format, but max(MonthStart) will be integer.  To make it work, a small change is needed:

Sum({$<Year=, Month=, MonthStart = {"<=$(=date(Max(MonthStart)))"}>} TransactionAmount))

asmithids
Partner - Creator II
Partner - Creator II
Author

Thank you swuehl.  That did the trick!!! 

asmithids
Partner - Creator II
Partner - Creator II
Author

Hi Michael,

I made the change.  Thank you!