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

Comparing two dates in Set Analysis

Hi, I am very new to Qlikview and I am comparing two different dates. In my script I set

LET vThreeDayAgo = Dayname(today()-3); so the variable ends up looking like this 09/07/2012 today.

I am comparing this in this set analysis syntax but get the sum of everything for DaysFilled.Days in the table.

The DaysFilled.Date is formatted mm/dd/yyyy. I have verified that there is a DayFilled.Date = 09/07/2012.

sum({$<DaysFilled.Date={"=vThreeDayAgo"}>} DaysFilled.Days)

Can someone tell me what is wrong with the above Set analysis?

Any ideas would be greatly appreciated.

Thank you,

OnePuttGirl

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

The format in the variable and the field are not the same, therefore the zeroes in the result. Check the ammended application and see how the variable has changed and works.

Hope that helps.

Miguel

View solution in original post

15 Replies
whiteline
Master II
Master II

sum({$<DaysFilled.Date={"=DaysFilled.Date=$(vThreeDayAgo)"}>} DaysFilled.Days)

MayilVahanan

HI

sum({$<DaysFilled.Date={$(vThreeDayAgo)}>} DaysFilled.Days)

Edit:

sum({$<DaysFilled.Date={'$(vThreeDayAgo)'}>} DaysFilled.Days) miss qoutes..

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi,

Thank you for your response. I don't know why but when I do this I get null values. And the one above this I get zeros.

Any ideas why?

Miguel_Angel_Baeyens

Hi,

Probably it's due to the fact that Dates are represented as literals (strings) so using single quotes should work:

Sum({< DaysFilled.Date = {'$(vThreeDayAgo)'} >} DaysFilled.Days)

or event to the fact that you need to expand the variable using the equal sign and using single quotes:

Sum({< DaysFilled.Date = {'$(=vThreeDayAgo)'} >} DaysFilled.Days)

Hope that helps.

Miguel

Not applicable
Author

Miguel,

I did both of the expressions and I still get zeros. Is there anything else you would try?

whiteline
Master II
Master II

As my and Miguel's expressions gives you zeros,

I suggest create a table box and check to be sure that zeros is not the right answer.

Not applicable
Author

How do I attach my .qvw?

Not applicable
Author

Ok, I attached a qvw and the expression is for Monday. Can you tell me why I'm getting nothing?

Not applicable
Author

Zeros is not the correct answer. Can you check my .qvw I attached and see if you can get the correct result?