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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum between two days ( variables) disregarding actual selections

Hi everybody, hope somebody can help with this.

I want to create a table with 2 rows. The first one should have the following expressions

Sum({$<Date={">=$(#vStartMonthDate)<=$(#vDate)"} >} [sales] )

the second one this one

Sum({$<Date={">=$(#vStartMonthDateLY)<=$(#vDateLY)"} >} [sales] )

When I select the field Date, let's say with 10/01/2015 the table would show something like this

the column row is a dimension I load inline, just to have two rows. and the expression would be

if(row=1, Sum({$<Date={">=$(#vStartMonthDate)<=$(#vDate)"} >} [sales]),

Sum({$<Date={">=$(#vStartMonthDateLY)<=$(#vDateLY)"} >} [sales] ))

les] )

I don't know if this is possible.

Thanks in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached qvw.


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached qvw.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thanks a lot Gysbert, you made my day. It works pretty good. Just one question. The problem were just the double quotes (")?

Regards

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

No, more likely the # that the variables start with. That required adding an extra # in front of them. That's because the # is also used to force a numeric evaluation of a dual value.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Ok but I don't get it because I had defined my variables without the #, like this:

vDate, vDateLY    

and so on,

So with just one # should've been enough, or am I wrong?

Thanks for your time

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If your variables don't start with an # then one # is enough to force the numeric evaluation. The double quotes work as well as single quotes. So I don't know why you were having problems.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Me neither, but I will follow your indications anyway.

Have a good day.