Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get a count from values between a certain range

Dear all,

I have the following data that I would like to load

LOAD * INLINE [
DATE, WEEKIN
2012-02-02, 2
2012-02-02, 3
2012-02-02, 4
2012-02-04, 4
2012-02-06, 6
]
;

And I have set the following variables:

set vDate1 = "2012-02-02";
set vDate2 = "2012-02-04";

I would  like to create a graph that shows the count of the values between date1 and date2. So therefore I created a graph with the following expression

count(<DATE={'>=$(vDate1) <=$vDate2)'}>}[WEEKIN]

But this gives me an error. Any thoughts on where I go wrong?

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Perhaps this?

count({<DATE = {'>=$(vDate1) <=$(vDate2)'}>}[WEEKIN])


Attached

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

View solution in original post

6 Replies
Anil_Babu_Samineni

Perhaps this?

count({<DATE = {'>=$(vDate1) <=$(vDate2)'}>}[WEEKIN])


Attached

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
sunny_talwar

What error are you getting?

Not applicable
Author

Hi Anil,

Thanks. For your reply. I am getting a graph now but the count seems to be wrong... I get a count of 5 now. While only 4 values fit the criteria.... Any thoughts?

Anil_Babu_Samineni

Yes, Because your data has 3 times for vdate1. If you want to show values of Count, you can use Values on Data Points

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
vinieme12
Champion III
Champion III

Can you give a screenshot of what you are looking at or your own sample qvw? the expression above by Anil should give you the correct result.

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

I already solved it! Thanks for your input guys!