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

Variables in sum

Hello,

Maybe can someone tell me what i am doing wrong. My task is to calculate sum of previous DrawID starting from today.


Right answer i get when do like this :  sum({$<DrawID = {'<3'} >}[Ticket.Amout] )

I defined  variable vCurrentEdition like this  Num#(if( DrawDate = today() , DrawID),'#.#', '.' , ','),  also tried if( DrawDate = today() , DrawID) both variations gives the right answer 3 .

To count sum i tried this variations:

sum({$<DrawID = {'< $(vCurrentEdition)'} >}[Ticket.Amout] )

sum({$<DrawID = {"< $(vCurrentEdition)"} >}[Ticket.Amout] )

sum({$<DrawID = {'< vCurrentEdition'} >}[Ticket.Amout] )

sum({$<DrawID = {"< vCurrentEdition"} >}[Ticket.Amout] )

sum({$<DrawID = {vCurrentEdition} >}[Ticket.Amout] )

Unfortunately none of them works. What should i do to count sum.



Thanks in advance. 

10 Replies
sunny_talwar

Can you try this:

Sum({$<DrawID = {'<$(=vCurrentEdition)'} >}[Ticket.Amout])

Not applicable
Author

Hello, thank for fast replay. It does not work

sunny_talwar

How about if you change single quotes to double quotes here?

Sum({$<DrawID = {"<$(=vCurrentEdition)"} >}[Ticket.Amout])

Anonymous
Not applicable
Author

Try this one


=Sum({$<DrawID = {<$(=$(vCurrentEdition))} >}[Ticket.Amout])

Not applicable
Author

Already tried. does not work. Maybe something wrong with my variable

Not applicable
Author

Does not work. I also tried with different quotes.

=Sum({$<DrawID = { ' <$(=$(vCurrentEdition)) ' } >}[Ticket.Amout])

=Sum({$<DrawID = { " <$(=$(vCurrentEdition)) " } >}[Ticket.Amout])


sunny_talwar

May be share a sample so that we can dig deeper into the issue for you

Not applicable
Author

Sure. Here is my data, and calendar that i am using.

tresesco
MVP
MVP

Try putting '=' before expression while defining your variable.