Qlik Community

Ask a Question

Qlik NPrinting Discussions

Discussion Board for collaboration on Qlik NPrinting.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Giada1990
Partner
Partner

problem with a date filter in qlik nprinting

Hi,

I have a numeric field like this for a date: 202101 , 202102, 202103, 202104.

I used this formula that works in qlik view to have the current month: =Max(Date(Date#([YYYYMM (Anno - Mese)], 'YYYYMM'), 'YYYYMM'))

I put this formula in qlik nprinting filter but it doesn't work, why?

How can I do?

Thank you

Labels (2)
1 Solution

Accepted Solutions
Lech_Miszkiewicz

It does not matter what works in QlikView in this case...

QlikView may apply this formula as text search (not a numerical value search), on the other hand NPrinting is looking for numerical value (which i explained in my post I have given you link to in my post above)..

So again - what is the field value if you put it in the table and use expressions like:

  • text([YYYYMM (Anno - Mese)])
  • floor([YYYYMM (Anno - Mese)])

If values are the same for text and floor/number then your formula is simply wrong. At the same time I would say you just overcomplicated it as you could simply use: 

  • if field is numerical:
    • =Max([YYYYMM (Anno - Mese)])
  • or if field is text field then 
    • =Max(num#([YYYYMM (Anno - Mese)]))

Now I will say it again - we MUST know how this field is loaded and understand what datatype it inherits in order to give you 100% accurate answer.

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.

View solution in original post

6 Replies
Ruggero_Piccoli
Employee
Employee

Hi,

Did you selected "Evaluate Value" on the drop down menu? https://help.qlik.com/en-US/nprinting/February2021/Content/NPrinting/ReportsDevelopment/Static-dynam...

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.
Giada1990
Partner
Partner
Author

Hi,

@Ruggero_Piccoli  yes but it doesn't work, I tried with evaluate value and advance research but they don't work

Lech_Miszkiewicz

Hi - there is obvious change of type of data you are doing and value change too...

you are saying that you have numerical field with values like: 202101,202102... which i take means that they are actual numbers? aren't they?

so when you you use Date# you are converting it to completely different values being: 44197 (for 202101), 44228 (for 202102)

It is basic understanding what Date# and Date function does to the numbers. This is all documented in help documentation. Please make sure you read examples from that help too...

https://help.qlik.com/en-US/sense/February2021/Subsystems/Hub/Content/Sense_Hub/Scripting/Interpreta...


Then you may want to read this post about most common pitfals re date filtering in NPrinting to complement the topic https://nprintingadventures.com/2019/02/15/the-pitfalls-of-nprinting-filters-part-1-dates-and-duals

 

If this still does not help then next question is how you create your 202101, 202102 in Qlik script to understand what value is hidden behind the symbol value!

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.
Giada1990
Partner
Partner
Author

Hi @Lech_Miszkiewicz , that formula works in qlik view and gives me 202104, the original field is a numeric field, so which formula should I use in nprinting filter to have the current month for this field?

Thanks

Lech_Miszkiewicz

It does not matter what works in QlikView in this case...

QlikView may apply this formula as text search (not a numerical value search), on the other hand NPrinting is looking for numerical value (which i explained in my post I have given you link to in my post above)..

So again - what is the field value if you put it in the table and use expressions like:

  • text([YYYYMM (Anno - Mese)])
  • floor([YYYYMM (Anno - Mese)])

If values are the same for text and floor/number then your formula is simply wrong. At the same time I would say you just overcomplicated it as you could simply use: 

  • if field is numerical:
    • =Max([YYYYMM (Anno - Mese)])
  • or if field is text field then 
    • =Max(num#([YYYYMM (Anno - Mese)]))

Now I will say it again - we MUST know how this field is loaded and understand what datatype it inherits in order to give you 100% accurate answer.

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.

View solution in original post

Lech_Miszkiewicz

To add one more comment regarding syntax. I would also looked at other filters you are applying and depending if Max(your date) needs to return max for intersection (or not?) with other selections you may also use set analysis as an optional parameter:

  • if field is numerical:
    • =Max({1}[YYYYMM (Anno - Mese)])
  • or if field is text field then 
    • =Max({1}num#([YYYYMM (Anno - Mese)]))

 

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.