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: 
Anonymous
Not applicable

Set analysis to filter fields in chart

Hi,

Would like to know on how can I filter the fields in Qliksense chart using set analysis.

Currently I am trying this code:

=If(vSourceType = 'Data 1', Only({$<SourceType = {"Data 1"}>}SourceType), Only({$<SourceType = {"Data 2"}>}SourceType))

What I want to return is when user select the Data 1 in selection, then Data 1 will only appear in SourceType field. Else, Data 2 in SourceType.

Thanks in advance!

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I found the right answer somewhere in other post here in community.

I really appreciate your effort by replying  to this post and looking forward to learn more in Qlik!

View solution in original post

13 Replies
sunny_talwar

Where is the above expression used? What exactly are you trying to display?

jmvilaplanap
Specialist
Specialist

Hi,

I think is not necessary use "Set Analysis" if you put a list with values "Data 1", "Data 2" etc... and you force it to have one selected value... is enought, isn´t it?

Regards.

Anonymous
Not applicable
Author

It's Qliksense dashboard, when dashboard user select these selection, the export button would export the data which exclusively selected.

Selection.JPG

Don't know what is wrong in my expression in export button.

Expression.JPG

sunny_talwar

Can you try this

=If(vSourceType = 'Data 1', 'Data 1', 'Data 2')

Anonymous
Not applicable
Author

Thanks for being patient, Sunny. When I use that expression and hit the download button, it return this data.

output.JPG

No more Data 2 in the field but the count is just the same. I guess it just replace the Data 2, not to export only the Data 1 exclusively.

Is there a set analysis that I can filter the field in Qliksense? Below expression is not working.

=Only({$<SourceType = 'Data 1'>-1<SourceType='Data 2'>}SourceType)

sunny_talwar

But isn't vSourceType a variable? I am not sure I am able to follow what you are looking to do...

Anonymous
Not applicable
Author

Yes, vSourceType is a variable. This variable toggles if user select Data 1 or Data 2.

Selection.JPG

Then, expression you provided is what I used here.

download.JPG

But when I download the file, it shows me the whole data. Not filtered by Source Type which user selected.

Apologies if I made you confused.

sunny_talwar

Source Type is an Island table? Is it not linked to your data model?

Anonymous
Not applicable
Author

It is linked in data model. It's actually part of link table.