Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
manideep78
Partner - Specialist
Partner - Specialist

Dynamic value in variable

Dear Community,

I want to get the value dynamically in a variable based on a condition.

 

KvValue
2163.7
229.92
235.84
244.6
254.03
3195.7
3213.4
337.51
345.74
354.93

The condition is like if K=2 and v=1 then 63.7.

like this i have to get the value stored in the variable based on a condition.

above table is a sample table. The original table consists of 1000 records. I have to look at all the conditions and then get the value in the variable.

Please let me know how can we achieve this.

Thanks in advance.

Regards,

Manideep

1 Solution

Accepted Solutions
sunny_talwar

If Item and Category are fields then may be this:

=Only({<K = {"$(=Count(DISTINCT ITEM))"}, v= {"$(=Count(DISTINCT Customers))"}>}Value)

View solution in original post

7 Replies
vardhancse
Specialist III
Specialist III

Hi,

even though the data is more we can maintain separate condition for each one dimension/expression.

so while creating the variable, add the condition and create different variables.

or

Attach a sample QVW, so that we can understand easily.

sunny_talwar

May be this:

vVar: =Only({<K = {"$(=Concat(DISTINCT K))"}, v= {"$(=Concat(DISTINCT v))"}>}Value) or

vVar: =Only({<K = {"$(=GetFieldSelections(K))"}, v= {"$(=GetFieldSelections(v))"}>}Value)


Based on your selection in K and v list box, the value of vVar will change

manideep78
Partner - Specialist
Partner - Specialist
Author

Hi

Here I need to compare expression values with K and V.

K -  count(DISTINCT ITEM)

V- Count(DISTINCT Customers)

so, if( K = count(DISTINCT ITEM) and V= Count(DISTINCT Customers), Value)

             k =2 and V=3, then 5.84

Note: I don't have ITEM and Customers as filters. I do not want to add those filters.

sunny_talwar

If Item and Category are fields then may be this:

=Only({<K = {"$(=Count(DISTINCT ITEM))"}, v= {"$(=Count(DISTINCT Customers))"}>}Value)

manideep78
Partner - Specialist
Partner - Specialist
Author

I tired, but no luck

sasiparupudi1
Master III
Master III

Please post your application

manideep78
Partner - Specialist
Partner - Specialist
Author

got it. Thanks sunindia