Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Sara_3
Creator
Creator

how to use Variable instead of field in the following expression

the following is my expression with field (Value6Months)and it worked perfectly, Now I am using variable ($(Last6value) instead of field . When I was using the field it gave me limited data according to the expression now with variable it gives me all values. how to put variable ($(Last6value)) in the expression instead of field ( Value6Months)?

my variable is :$(Last6value)---Sum({<Date = {"$(='<=' & Date(today(),'YYYY-MM-DD'))"},Date= {"$(='>=' & DATE(MonthStart(Today(),-6),'YYYY-MM-DD'))"},[SA Status]={' Receipt'}>} [Total Value])

Expression:   

Sum(Aggr(

If( Rangesum(Above(Sum( Value6Months)/Sum(total Value6Months),1,RowNo()))<=0.8,

Sum(Value6Months)),

([GSC Vendor Name],(=Sum(Value6Months),desc))

))

 

Thanks.

Labels (5)
9 Replies
daturpin
Partner - Creator II
Partner - Creator II

You should just have to replace the Value6Months with Last6Value

You shouldn't need dollar-sign expansion since the expression in the variable is already written that way.

Try deleting one of the Value6Months and start typing Last6Value in its place; Qlik will recognize what you are doing and a tooltip should popup saying [Last6Value               variable], along with other similarly named columns, variables, etc. and you can click it to make sure you have the format correct.

Sara_3
Creator
Creator
Author

I tried to replaced the field with variable without $ it gave me zero values. I tried the following expression:

Sum(Aggr(

If( Rangesum(Above(Sum(vLast6value)/Sum(total vLast6value),1,RowNo()))<=0.8,

Sum(vLast6value)

)

,

([GSC Vendor Name],(=Sum(vLast6value),desc))

))

Thanks!

daturpin
Partner - Creator II
Partner - Creator II

If you open your variable list, does it show the value of Last6Value as zero?

Sara_3
Creator
Creator
Author

I can see in the value is expression not any value.

Sara_3
Creator
Creator
Author

I am using the following right now , it gives me all values not according to the <=0.8.

Sum(Aggr(

If( Rangesum(Above($(vLast6value)/sum (total $(vLast6value)),1,RowNo()))<= 0.8,

$(vLast6value))

,

([GSC Vendor Name],(=$(vLast6value),desc))

))

daturpin
Partner - Creator II
Partner - Creator II

You see an expression in the "Value" column for the variable?

 

Mine looks like this; the variable expression should evaluate or there might be a problem with the expression itself:

Sara_3
Creator
Creator
Author

i just put = in the beginning of the variable and I can see the value but with the variable expression I got zeros still.

daturpin
Partner - Creator II
Partner - Creator II

=Sum({<Date = {"$(='<=' & Date(today(),'YYYY-MM-DD'))"},Date= {"$(='>=' & DATE(MonthStart(Today(),-6),'YYYY-MM-DD'))"},[SA Status]={' Receipt'}>} [Total Value])

Returns zero? Or 

Sum(Aggr(If( Rangesum(Above($(vLast6value)/sum (total $(vLast6value)),1,RowNo()))<= 0.8,$(vLast6value)),([GSC Vendor Name],(=$(vLast6value),desc))))

Returns zero?

 

Sara_3
Creator
Creator
Author

Sum(Aggr(If( Rangesum(Above($(vLast6value)/sum (total $(vLast6value)),1,RowNo()))<= 0.8,$(vLast6value)),([GSC Vendor Name],(=$(vLast6value),desc))))

it gives me perfect values but all values  not limited.

 

Thanks.