Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rolling 12 months bases on a Date selection

Hi,

I'm looking for an set analysis statement that gives me the rolling 12 months Sales bases on an OrderDate selection (listbox)

This expression:

=sum(if(OrderDate>addmonths(vDate,-12) and OrderDate<=addmonths(vDate,0), LineSalesAmount)) (//vDate = variable)

.....into set analysis.

I hope you can help me!



1 Solution

Accepted Solutions
Not applicable
Author

=sum({<Date(OrderDate)="{$>vStartDate<vDate}" >}Sales)

values in the OrderDate is timestamp . when i put Date function in front of the OrderDate , its giving values.

View solution in original post

11 Replies
Not applicable
Author

Use the following expression:

=sum({<OrderDate={"$>vStartDate<vDate"} >} LineSalesAmount)

where,

vStartDate = addmonths(vDate,-12)


Not applicable
Author

I got a 0 as result

Not applicable
Author

I guess, it could be due to the values of the variables. Have you defined the variables correctly. Check the values of the variables 'vStartDate' and 'vDate' and see if they are different.

Not applicable
Author

vDate = 1-1-2009

vStartDate = 1-1-2008

but the expression gives still 0.

Not applicable
Author

Can you check with this:

=sum({<OrderDate="{$>$(vStartDate)<$(vDate)}" >} LineSalesAmount)

The quotes were placed wrongly in the last expression

tresesco
MVP
MVP

Hi,

try the set analysis like this,

=sum({<[OrderDate]={">$(vStartDate)<$(vDate)"}>} LineSalesAmount)

Hope this would help,

Regards,

tresesco

Not applicable
Author

Hi,

Still 0 as result.

I tried the expression below for testing vStartDate en VDate and this is working fine.

=



sum(if(OrderDate>=vStartDate and OrderDate<vDate, LineSalesAmount))

Not applicable
Author

can you attach an example document. I will check the expression in the file.

Not applicable
Author

Hope you can find what I am doing wrong!