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

set analysis and dates range

Hi everyone.

I'm trying to use the  set analysis to evaluate a sum between two dates.

I set two variables and my [Posting Date] field is numeric.

vMonthStart =Num(MonthStart(AddMonths(Only(MonthYear),1)))

vMonthStop =Num(AddMonths(Only(MonthYear),-11))

I'm using this expression :

=Sum({1<[Posting Date]={">$(vMonthStart) <=$(vMonthStop)"}>} [Line Amount (LCY)])

The purpose is to evaluate the sum for the past 12 months (selected MonthYear, and only one, included) but for now the sum isn't good.

I use a textbox to verify the variables and they seem right.

Example :

Selecting MonthYear to dec.-2015 give me vMonthStart = 42370 (01/01/2016) and vMonthStop = 42005 (01/01/2015) which is correct but the sum is still false.

As a reference i'm using this expression Sum({1<Year={$(vYear)}>}[Line Amount (LCY)])) and in that case the sum is correct.

I looked at countless community discussions but none fix my problem, and I obviously don't see or understand what I'm missing here.

In advance, thanks for you help and sorry for my english mistakes ... not native. ^^

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Your vMonthStart is larger than vMonthStop, so you won't select the range of dates between these two values, but the complement, AFAIR.

I think you need to exchange your definitions of Start and Stop.

View solution in original post

1 Reply
swuehl
MVP
MVP

Your vMonthStart is larger than vMonthStop, so you won't select the range of dates between these two values, but the complement, AFAIR.

I think you need to exchange your definitions of Start and Stop.