Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Pomna
Creator III
Creator III

Filter By Previous Day

I need help creating a filter in Nprinting to get only values for the previous day. Below is what I have got but it does not give me the expected answer. Your suggestions will be appreciated. Thanks

Pomna_0-1600828536386.png

 

Labels (2)
3 Solutions

Accepted Solutions
robert_mika
Master III
Master III

Change Advance Search to Evaluate Value and in the field enter

=Today()-1

View solution in original post

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Pomna 

@robert_mika answer will work if your date field which I assume is  "CusSat Created Date" is loaded as a date without timestamp. On Qlik script side it should be loaded with statement similar to following:

Load

....

Date(Floor(somedate)) as [CusSat Created Date]

....

The above scenario will filter down data on [CusSat Created Date] only to yesterdays records.

 

I also looked at your screenshot and I am trying to understand what you have tried to do in there. You have used [Date] field and you wanted to filter [CusSat Created Date] by using association to [Date] field which you wanted to filter to records greater or equal than yesterdays date.

Now the question is:

  • do you have [Date] field in your data model and did you want to use it to apply filters on [CusSat Created Date]?
    • If you do - then how those 2 fields are associated in your data model as results will depend on association

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

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

There are 3 possible separate issues with this:

  1. first issue is more of a conceptual one. If you want to see last 7 days you need to create in your filters 7 rows like below, as effectively you are talking not about one but multiple days:
    • Evaluete Value =Floor(Today()-1)
    • Evaluete Value =Floor(Today()-2)
    • Evaluete Value =Floor(Today()-3)
    • ...
    • Evaluete Value =Floor(Today()-7)
  2. Second issue is related to the error you attached. For some reason this filter cannot be applied and there can be multiple reasons. First one which came to my mind was that you have "Always one selected value" set on this field in QlikView  (and/or triggers) - both are not supported and need to be removed from your document if they exist. The other option would be to apply Floor() function on calculation - see in the example above the red highlighted part. I know that in this case it shouldn't matter but I want to make sure that the actual value of the filter is not an issue here..
  3. Do you apply any other filters (on task, report, user level) which would exclude data for Today()-2 etc days? 

You may also provide a screenshot of your filter in NPrinting for a reference here. 

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

12 Replies
robert_mika
Master III
Master III

Change Advance Search to Evaluate Value and in the field enter

=Today()-1

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Pomna 

@robert_mika answer will work if your date field which I assume is  "CusSat Created Date" is loaded as a date without timestamp. On Qlik script side it should be loaded with statement similar to following:

Load

....

Date(Floor(somedate)) as [CusSat Created Date]

....

The above scenario will filter down data on [CusSat Created Date] only to yesterdays records.

 

I also looked at your screenshot and I am trying to understand what you have tried to do in there. You have used [Date] field and you wanted to filter [CusSat Created Date] by using association to [Date] field which you wanted to filter to records greater or equal than yesterdays date.

Now the question is:

  • do you have [Date] field in your data model and did you want to use it to apply filters on [CusSat Created Date]?
    • If you do - then how those 2 fields are associated in your data model as results will depend on association

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.
Pomna
Creator III
Creator III
Author

I added the following to my load script 

Date(Floor([CusSat Date])) as [CusSat Created Date] to my load script

and  Evaluete Value =Today()-1

It worked. But when I  want to see two previous days 

Today()-2 

or seven previous days

Today()-7

I  get an error message. Is there a reason for that? Thanks

Ruggero_Piccoli
Support
Support

Hi,

Please specify the text of the error message.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
Pomna
Creator III
Creator III
Author

Below is the error message I get 

Pomna_0-1600873988612.png

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

There are 3 possible separate issues with this:

  1. first issue is more of a conceptual one. If you want to see last 7 days you need to create in your filters 7 rows like below, as effectively you are talking not about one but multiple days:
    • Evaluete Value =Floor(Today()-1)
    • Evaluete Value =Floor(Today()-2)
    • Evaluete Value =Floor(Today()-3)
    • ...
    • Evaluete Value =Floor(Today()-7)
  2. Second issue is related to the error you attached. For some reason this filter cannot be applied and there can be multiple reasons. First one which came to my mind was that you have "Always one selected value" set on this field in QlikView  (and/or triggers) - both are not supported and need to be removed from your document if they exist. The other option would be to apply Floor() function on calculation - see in the example above the red highlighted part. I know that in this case it shouldn't matter but I want to make sure that the actual value of the filter is not an issue here..
  3. Do you apply any other filters (on task, report, user level) which would exclude data for Today()-2 etc days? 

You may also provide a screenshot of your filter in NPrinting for a reference here. 

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.
Pomna
Creator III
Creator III
Author

Thank you for all your help. When I do just the date filter with just one field or only the assigned team filter with only one field  it runs without issue. But when I create a second field (see screen shots below) that is when I get issues. 

Pomna_2-1601073501372.png

Pomna_4-1601073591934.png

 

Pomna_0-1601073393608.png

 

 

 

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

ok then it looks like combinations of values you are trying to apply is not possible in your data model or your filter for Assigned team is created wrong although based on what you say it is not as it works on its own..

So just to confirm my first guess I suggest you go to Qlik Sense app an try applying this selection there - is it possible?

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.
Pomna
Creator III
Creator III
Author

The selection works in Qlik Sense. Assigned team is filtered by date. Please see screen shot below

 

Pomna_2-1601306816028.png