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: 
Jenny_Sa
Contributor
Contributor

Calculate sum of an indicator between 2 dates for each month in expression

Hello, 

I have a table with :

- DATE (monthyear format : YYYYMM)

- a contract number

- FLAG : a flag (=1 or 0)

- other indicators

In my report I've build  a table :

- dimension : contract number, year month

- expression : sum of flag of past 12 months 

So, I need to calculate for each contract and each month the sum of past year.

Here is my expression (not working) :

Sum({<DATE={">=$(=Date(AddMonths(Max(DATE),-12),'YYYYMM'))<=$(=Date(AddMonths(Max(DATE),-1),'YYYYMM'))"}>}FLAG)=0

Your help would be highly appreciated because I'm stuck with this problem for so long.

 

1 Reply
nancychandler340
Contributor
Contributor

the convention that people use most often is that y depends on x. Really, though, 'x' and 'y' are just names that could be swapped out for any other symbols.

Myindigocard