Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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