Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
paul_ripley
Creator III
Creator III

Using a variable to calculate a period in an expression

Hello

I would like to use a report in QV the present results based on the current period in our general ledger system.

I am loading the field cur_period from the general ledger system

Period:
LOAD * ;
select p.period as cur_period from acrtransgr p

I then set up a variable vCur_period with the definition  =cur_period

And then in the expression have used

=sum({$ <period = {"=$(vCur_period)"} >}Count)

to try to pick up the current period, but it doesn't seem to recognise the variable.  What am I doing wrong?

Many thanks

Paul

1 Solution

Accepted Solutions
sunny_talwar

How about this?

=Sum({$<period = p(cur_period)>} Count)

View solution in original post

5 Replies
Anil_Babu_Samineni

How you defile the variable? May be this?

=sum({$ <period = {"=$(=vCur_period)"} >}Count)


Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

How about this?

=Sum({$<period = p(cur_period)>} Count)

paul_ripley
Creator III
Creator III
Author

Thanks Sunny that worked.  Can I just ask you the significance of the 'p' before (cur_period)

sunny_talwar

p() and e() are part of indirect set analysis... look here:

P() &amp; E() and where do you use them?

sunny_talwar

Also here:

P() &amp; E()