Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current Year value for a particular variable value

Hi All,

I have requirement where I need to find out current year sales.Looks below expression is good for current year.

Sum({<Year = {'$(=Year(Today()))'}>}Sales)

But my requirement is i want to find out the current year sales based Variable value.

for example:

my Variable is "vIndicator",this variablewill store the values like A,B,C.

I want to find the current year sales where variable :vIndicator" value is 'A'

Sum({<Year = {'$(=Year(Today()))'}>,sum(if($(Indicator)='A')Sales)??

Any suggestions ?

Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Sasi, Looks your solution not working .

finally I got it here below the expression.

sum(if(Year=$(vCurrentYear),if($(vIndicator)='3. Due Later',[Undelivered Net value USD])))

Thanks to all for your valuable suggestions.

View solution in original post

11 Replies
Not applicable
Author

Hi Swathiraj,

How is your variable value?

If it is based on some field value, then you can use the below.

Sum({<Year = {'$(=Year(Today()))'}, Field={'$(=$(vIndicator))'}>})Sales)

martinpohl
Partner - Master
Partner - Master

Hello,

use

Sum({<Year = {'$(=Year(Today()))'}, Indicator ={'$(=vIndicator)'} >}Sales)

Regards

ashfaq_haseeb
Champion III
Champion III

Hi,

Try something like this

Sum({<Year = {'$(=Year(Today()))'},Field={'$(=vIndicator)'}>Sales)


Make sure you replace Field with your actual field


Regards

ASHFAQ

Not applicable
Author

Thanks for your reply,

No my variable value is not based on field.

I need to sum the based on  like this way

sum(if($(vIndicator)='A',Sales))--->it will give the all years sales where variable =A,

but I want only for current year.


Not applicable
Author

Thanku Ashfaq but your requirement suits when we use field.

but my requirement looks like below

sum(if($(vIndicator)='A',Sales))--->it will give the all years sales where variable =A,

but I want only for current year.

ashfaq_haseeb
Champion III
Champion III

Post sample data with expected output.

why you need to filter with variable if it is not associated.

Regards

ASHFAQ

sasikanth
Master
Master

Hi

Tell me what is the expression/Logic your using in vIndicator

then it will be easy

Not applicable
Author

Hi,

Because my variable has created  multiple field condition from multiple tables.

here is the var condition,

If ([VAR ETO]='ETO', if([Suspension Flag - MM]<> '#' ,'A',

  If(Today()- RDD = 0, 'B',

  If([Qty Open] > 0 And RDD < Today(), 'C',

  If([YearMonth RDD]=vYearMonthCurrentDate, 'D',

                       If( [YearMonth RDD]<>vYearMonthCurrentDate  , 'E',

                              If([Qty Open] <=0, '4. Delivered'))))))

Now I want to find the sales only for variable value as A.

Not applicable
Author

hi,

hi,

will it work to find vindicator = A for current year??

if(year=$(vCurrentYear),sum(if($(vIndicator)='A',Sales))