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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

How about this?

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

View solution in original post

5 Replies
Anil_Babu_Samineni
MVP
MVP

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
MVP
MVP

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
MVP
MVP

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

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

sunny_talwar
MVP
MVP

Also here:

P() &amp; E()