Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner
Partner

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
Partner

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
Partner
Author

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

I have attached a sample.

hopkinsc
Partner
Partner
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
Partner

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

jagan
MVP
MVP

Hi,

Try like this

vWeekIndex = Max([Current Week Index])

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

Regards,

Jagan.