Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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?

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

Try like

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

its_anandrjs

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
Luminary Alumni
Luminary Alumni

Hi,

Try like this

vWeekIndex = Max([Current Week Index])

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

Regards,

Jagan.