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: 
Not applicable

Sum with variable dates

Hi All

I am unable to convert other answers to my file - I am new to QV, so am hoping someone can help:

I am trying to create a straight table showing:

Date1

Date2

Difference

I created variables for Date1 and Date2 to create a calendar for both, hoping to sum the number of complaints per area within a certain week: [Complaint_Weekend].

Is someone able to help with the Syntax for this, it would be much appreciated! So it should look something like

Sum of number of Complaints with [Complaints Weekend] = vDate1

Sum of number of Complaints with [Complaints Weekend] = vDate2

then the difference between the two.

Thanks in advance

Neil Allen

1 Solution

Accepted Solutions
Not applicable
Author

There is nothing to be sorry for. QV is easy to learn just give it some time

The format is to be added to the expression. For instance my original post

Sum({<[Complaints Weekend] = {"$(vDate1)"}>} numberofComplaints)

should be changd to

Sum({<[Complaints Weekend] = {"$(=date(vDate1))"}>} numberofComplaints)

If the problem persists can you share your qvw for us to debug?

Kiran.

View solution in original post

12 Replies
Not applicable
Author

2011-11-03 12h47_14.png

Not applicable
Author

If you a field for number of complaints the following would work:

Sum({<[Complaints Weekend] = {"$(vDate1)"}>} numberofComplaints). Like wise for vDate2.

Hope this helps,

Kiran.

Not applicable
Author

Hi Kiran

The complaints are given a value of one, and use [Complaints_Counter], however this brought through 0's, with the variables, do i need to give this a format in the variable settings so it matches the complaints_weekend field?

Thanks for the reply

Not applicable
Author

Yes. Your variables output and [Complaints Weekend]'s format should match.

Kiran.

Not applicable
Author

Are you able to tell me how it should look in the variable settings, please?

Thanks

Not applicable
Author

If you make a list box on [Complaints Weekend], what format are you seeing? The format is not on variable settings but should be acheived with date#

Kiran.

Not applicable
Author

I was hoping to avoid having a list box and a calendar box - when i look in the variable settings after putting in a value in to the calendar it appears in number format, even though I have formatted the calendar as D/MM/YYYY.

Neil

Not applicable
Author

Neil,

I wasnt asking to have a list box. For set analysis to work the format should match.

if your Variable returns number add date function around it. Like date($(vDate1)).

Kiran.

Not applicable
Author

Sorry Kiran, Excuse my ignorance, do you mean to put the date($(vDate1)) in the variable settings, or the expression in the straight chart or someone else..

Again, sorry for my ignorance

Neil