Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Pariente
Contributor
Contributor

Creating a filter for a SetAnalysis expression

Hello,

I am having some troubles while using a filter un NPrinting for an App, I would appreciate any help.

In the QlikSense App I have a KPI with a formula that includes a SetAnalysis expression in which I have a field (named "Compare") where evalues if it is selected or not in order to apply one expression or another in the SetAnalysis. In NPrinting, I created a filter for Compare field and when I've generated the report with this KPI, it shows the result of the formula WITHOUT the Compare field selected (like there is no filter applied).

Is there any conflict or problem between a filter in NPrinting for a field that it is included in a formula for a KPI??

Thanks in advance.

Best regards,

Pariente

Labels (2)
1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Pariente ,

First thing to check would be to ensure that your filter is applied. 

Can you share screenshot of your filter in NPrinting please?

Typically for this you would expose column [Compare] in form of table to see if the filter indeed is carried through to the report properly. Can you do that for testing please and confirm that your NPrinting filter works? It may be that the issue is not expression but simply the fact that filter is not properly applied. If it isn't applied then we would need to look at:

  • connections used to apply filter
  • field datatype (ascii text or numerical or maybe it is a dual?)
  • the way you apply your filter - here I asked about filter
  • are there any user or task filters which could interfere with it?
  • can you confirm that filter and reports are using the same Qlik Sense connection?

more about filters in here:

 

on the side note and not really related to the problem:

in the formula there is no need for date() function. The reason is the AddYears supersedes it anyway: 

if anything it should be like this but only if you need to change date mask from default one:

  • (date(AddYears(min(Date),-3))),

 

cheers

Lech

 

 

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.

View solution in original post

5 Replies
Frank_S
Support
Support

Hi @Pariente

 

I think it would be helpful if you could provide some additional context:

  • type of KPI you are using
  • visual representation/mockup of expected results
  • visual representation/mockup of actual results
  • The set analysis formula you are using

With this additional information I'm sure someone here may be able to point you in the right direction.

 

Kind regards...

 

 

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Pariente
Contributor
Contributor
Author

Hello and thanks for your reply.

The formula is the following:

Sum( {< Date={">=$(=if(Compare='A3',(AddYears(date(min(Date)),-3)),(AddYears(date(min(Date)),-1))))<=$(=if(Compare='A3',(AddYears(date(max(Date)),-3)),(AddYears(date(max(Date)),-1))))"}  >}  Sales)

I have to tables in the App, one with all the data from sales from all the countries, and another one just with one column (not related with the first table). Basically the formula shows the sales from the previous year of the selected date, unless you select this flag (Compare field) so it compares with Year-3.

The formula works perfectly in the App, but I am not able to make the filter Compare in NPrinting in order to make this formula work. I want a single task in NPrinting with 2 reports (PDF) attached, one without the Compare filter (this way it shows data of Year-1) and a second report (PDF too) but with the filter Compare. I created 2 reports, one of them with the filter and the other without, but both PDF's shows the numbers of Year-1.

Thanks in advance,

Pariente

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Pariente ,

First thing to check would be to ensure that your filter is applied. 

Can you share screenshot of your filter in NPrinting please?

Typically for this you would expose column [Compare] in form of table to see if the filter indeed is carried through to the report properly. Can you do that for testing please and confirm that your NPrinting filter works? It may be that the issue is not expression but simply the fact that filter is not properly applied. If it isn't applied then we would need to look at:

  • connections used to apply filter
  • field datatype (ascii text or numerical or maybe it is a dual?)
  • the way you apply your filter - here I asked about filter
  • are there any user or task filters which could interfere with it?
  • can you confirm that filter and reports are using the same Qlik Sense connection?

more about filters in here:

 

on the side note and not really related to the problem:

in the formula there is no need for date() function. The reason is the AddYears supersedes it anyway: 

if anything it should be like this but only if you need to change date mask from default one:

  • (date(AddYears(min(Date),-3))),

 

cheers

Lech

 

 

 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Pariente
Contributor
Contributor
Author

Hello Lech,

The Compare field it was a dual field... I just modified it and now it is not a dual, and the filter works perfectly... That was the problem.

Thank you so much.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

good news - cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.