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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
cafcptg2011
Creator
Creator

Set Analysis between a range of dates

Hi,

I need to make an expression that returns the costumers with sales betweeen 2 dates and without sales between 2 other dates...

my current expression is:

=sum({<  dat = {">=$(=date('01-01-2016','DD-MM-YYYY')) <=$(=date('31-08-2016','DD-MM-YYYY')) "}  ,   dat -= {">=$(=date('01-09-2016','DD-MM-YYYY')) <=$(=date('31-12-2016','DD-MM-YYYY')) "}   >} Sales)

but this expression doesn't work...

I need sales between 01-01-2016 and 31-08-2016 and with sales = 0 between 1-09-2016 and 31-12-2016..

and if want to know sales same period (01-01-2016 and 31-09-2016) but great then 1000 for instance... how can I accomplish that?

could some please help me?

Thanks in advance,

edit: the result that I want is here in this picture:

Cap.PNG

CAFC

30 Replies
Anil_Babu_Samineni

One last question from end, Why are you not showing costumer of 1 and 3 even those dates are with in the date ranges only. Just for confirmation

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda

what is the format of dat field?

cafcptg2011
Creator
Creator
Author

I'm expecting 182 and not 244...

why?

because the costumer 1 and 3 has sales one the between 1-09-2016 and 31-12-2016. I need only the costumer who has only sales in period of 1-1-2016 to 31-08-2016 and not between 1-9-2016 to 31-12-2016.

Kushal_Chawda

this expression is working for me.. please try in your application

=sum({<dat={">=01-01-2016<=31-08-2016"},dat-={">=01-09-2016<=31-12-2016"}>}sales)

Kushal_Chawda

Capture.JPG

cafcptg2011
Creator
Creator
Author

I'm expecting 182 and not 244... sorry


thank you

Kushal_Chawda

In your attached application, there is only one customer who with Date 1-9-2016, so out of total 271, 244 is should be the total

cafcptg2011
Creator
Creator
Author

no.. the costumer 1 and 3 have sales after 1-9-2016...

Kushal_Chawda

Yes so, two customer, having 12+15=27, so total 271-27=244.. is it not correct?

Kushal_Chawda

Why you are not trying this expression in your actual application and see the results?