Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

rva_heldendaten
Contributor III

Qlik Sense 2.2 automatic date handling - set analysis

Hi!

I'm just testing the Qlik Sense 2.2 automatic date handling.

From what I see it generates the script statement:  DECLARE FIELD DEFINITION Tagged ('$date')

The last thing I remember about "DECLARE" is, that it has a strange behavior with SET ANALYSIS.

From my tests SET ANALYSIS with Inline Variables I still see a strange behavior in QlikSense 2.2:

To calculate the previous year instead of

Sum({<MyDate.autoCalendar.Year={$(=max(MyDate.autoCalendar.Year)-1))}>}quantity)

I had to use

Sum({<MyDate.autoCalendar.Year={$(=year(max(MyDate.autoCalendar.Year))-1)}>}quantity)

See below a sample application; Without the year-function, the variable-expression returns a date, even I interact with the year-field in Set Analysis.

I just want to double check if this is working as designed, or is this a matter of change in future Qlik Sense releases. If so, I would have to wait before we implement this feature at customers.

Thx,

Roland

NordwindTest - Mein neues Arbeitsblatt  Arbeitsblätter - Qlik Sense - Mozilla F__2016-03-01_14-14-15.png

Tags (2)
6 Replies

Re: Qlik Sense 2.2 automatic date handling - set analysis

Can you post an app that demonstrates this?


talk is cheap, supply exceeds demand
rva_heldendaten
Contributor III

Re: Qlik Sense 2.2 automatic date handling - set analysis

See attached file!

Tested both in Qlik Sense 2.2.3 Server and Desktop!

Re: Qlik Sense 2.2 automatic date handling - set analysis

Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

You (or Qlik Sense) created your year field as a date. YearStart will return the first day of the year. That means that if you subtract 1 from a Year value you get the last day of the previous year. But the previous Year value will be the first day of that year and not the last. That's why you don't get a match. I suggest you create your Year field using the Year function only instead of creating a dual value using YearStart. Or use the YearStart function in your expression as well:

Sum({<MyDate.autoCalendar.Year={$(=YearStart(max(MyDate.autoCalendar.Year),-1))}>}quantity)


talk is cheap, supply exceeds demand
rva_heldendaten
Contributor III

Re: Qlik Sense 2.2 automatic date handling - set analysis

Thanks for analyzing this.

Yes, it's the code that Qlik actually generates, and I don't really understand why they do so!

Auto date handling seems to be a nice feature, but if it complicates SET Analysis even more,  I don't really get the point.

Why don't they generate an ordinary Year-Field (e.g. 2016 as String and Numeric value)?

May I have to ask Qlik Support, but probably they will return the case as WAD without further explanation ;-)

Re: Qlik Sense 2.2 automatic date handling - set analysis

Yeah, well a FBD (Faulty By Design) bug is still a bug. Making Quarter, Month and Week duals with the number of the quarter, month and week and then using Yearstart for the Year field is not logical nor consistent. It's a bug!


talk is cheap, supply exceeds demand
brunopreti
New Contributor

Re: Qlik Sense 2.2 automatic date handling - set analysis

‌Many thanks for your post! I became crazy for a couple of hours with exactly the same problem, since I read you. I think that this is a FBD.

Community Browser