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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

using variable in expression

Hi all,

I can't seem to get an expression working. I have a variable

vWeekIndex

which has the following definition...

=[Current Week Index]

which just returns the week index of a selected date.

I am trying to write an expression to reference this variable but add 1 also. so..

Sum({<[Current Week Index]={'$(vWeekIndex)+1'}>}[Room Revenue])

I have tried different variations but just can't seem to get it to work.

Any ideas?

Labels (1)
1 Solution

Accepted Solutions
SergeyMak
Partner Ambassador
Partner Ambassador

It works for me

sum({$<[Current Week Index]={$(=vWeekIndex+1)},Date>}[Room Revenue])

You need to clear selection of the Date field

Regards,
Sergey

View solution in original post

9 Replies
its_anandrjs
Champion III
Champion III

Try like

Sum({<[Current Week Index] = {"$(vWeekIndex)+1"}>}[Room Revenue])

its_anandrjs
Champion III
Champion III

Or you can try

Sum({<[Current Week Index] = {'$(vWeekIndex+1)'}>}[Room Revenue])

arsal_90
Creator III
Creator III

Check This

Sum({<[Current Week Index]={$(=$(vWeekIndex)+1)}>}[Room Revenue])

arsal_90
Creator III
Creator III

Check Also this

Sum({<[Current Week Index] = {$(vWeekIndex)+1)}>}[Room Revenue])

Not applicable

Use this

vWeekIndex = [Current Week Index]+1

Exp:

=Sum({<[Current Week Index] = {'$(vWeekIndex)'}>}[Room Revenue])

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Thanks all, but i can't get any of them to work.

I have attached a sample.

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

thanks Ravi,. I have already tried this option (which works) but i would prefer to use the +1 in the expression as i have to do 30+ expressions using +1, +2, +3 etc. i don't want to use 30+ variables

SergeyMak
Partner Ambassador
Partner Ambassador

It works for me

sum({$<[Current Week Index]={$(=vWeekIndex+1)},Date>}[Room Revenue])

You need to clear selection of the Date field

Regards,
Sergey
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

vWeekIndex = Max([Current Week Index])

Expression = sum({<[Current Week Index]={$(=vWeekIndex+1)}>}[Room Revenue])

Regards,

Jagan.