Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
VenkateshYarra
Contributor II
Contributor II

Using Getfieldselection need to select multiple values

HI All,

Wish you a very happy new year to all..🙂

I have two tables, where i need to calculate distinct values of each fields in each table.  ( All fields are same in both tables)

So i created one Inline Table using all fields for selection purpose. Below are the Image of Inline Table.

Capture12.PNG

 

vFields ='[Quotes.'&GetFieldSelections(Inline_Fields)&']'

Then in the expression i am using he below expression to get the results

=SUM(Aggr(Count(DISTINCT $(vFields)),$(vFields)))

Till here it is working fine. If i select it is show the value. But when user select multiple values/Fields in Inline table how to show the values. 

I tried the below expression 

vFields1  ='[Quotes.'& concat (distinct Inline_Fields,']'&','&'[Quotes.')&']'

But this is not working for me.

Can you any help me to solve this issue.

I need to get multiple values if i select multiple fields in Inline table. Like below image. Here all quote values are showing zero. 

Capture13.PNG

Kindly Ignore the Pricing. 

 

Thank you

Regards

Venkatesh

Labels (3)
1 Solution

Accepted Solutions
bramkn
Partner - Specialist
Partner - Specialist

A pick(match()) would be a better idea. always try to avoid using nested if statements.(or if statements alltogether in the frontend)

View solution in original post

3 Replies
lorenzoconforti
Specialist II
Specialist II

This is very tricky as you cannot use the value of a specific dimension as an input to another aggregation; unless you use a series of nested if statements; this is the formula to go in your table to replace the sum/aggr you have in there; also, you don't need extra variables:

=if(Inline_Fields = 'Active Flag',count(distinct [Quotes.Active Flag]),
if(Inline_Fields = 'Approval First Date',count(distinct [Quotes.Approval First Date]),
if(Inline_Fields = 'Approval Last Date',count(distinct [Quotes.Approval Last Date]),
if(Inline_Fields = 'Approval Status',count(distinct [Quotes.Approval Status]),
if(Inline_Fields = 'ID',count(distinct [Quotes.Active Flag]),'ID')
))))

Since the set of dimensions you are calculating the distinct values for is fixed I believe this is a viable solution; you just need to write the nested if statements once and then you are sorted

bramkn
Partner - Specialist
Partner - Specialist

A pick(match()) would be a better idea. always try to avoid using nested if statements.(or if statements alltogether in the frontend)

VenkateshYarra
Contributor II
Contributor II
Author

Thank you. 

If Condition as well as Pick and Match function are working, Both functions are working. I go with Pick and Match function

Thank you again