Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
atsushi_saijo
Creator II
Creator II

Pass dual datevalue as numeric in GetFieldSelections()

I need to pass a dual datevalue as numeric in GetFieldSelections(), to use the value in the set analyses.

Please see below example. We have Dec2014 selected in the 'Month' field, defined as a dual().

Error 1.jpg

GetFieldSelections(Month) seems passing text string 'Dec 2014' without passing 42005. But surely we cannot ask user to select 42005.


The intention is to use it as Sum({<Month={"<=GetFieldSelections(Month)"}>} Value).


I cannot allow such selection in this application since I am using this selection for various other aggregations in other expressions.

Error 2.jpg

Would you possibly advise any method, where I can pass the Month as a numeric value?

2 Replies
marcus_sommer

You don't have really a month-field - the first is a period-field and the second a numeric date-field. Therefore it's easier to use real numeric fields like Year: 2012 - 20XX and Month: 1 - 12 and as well something like a month-counter which starts with your first possible month and adds one for each month - this makes calculation over annual limits a lot easier.

These field-values could you get then with expressions like: max(NumericMonth) even this field isn't used for selection (but they must be assigned - in best case per master-calendar).

Of course you could grab the data per getfieldselections and transformed it per date#() or date() and/or num#() or num() or you picked your wished data per field-functions like: fieldvalue('Mth', fieldindex('Month', getfieldselections(Month))). But all this is unnecessary complicated compared with using real numeric fields.

- Marcus

atsushi_saijo
Creator II
Creator II
Author

Dear Marcus,

I appreciate for your fast feedback within the same day. I understand your valid points as well, and wish to have some remark.

The 'month' field is MonthName(datevalue), so this is already converted similar to MonthEnd(datevalue). Therefore 'same-month with different year' is already remedied. This method does work as same fashion as your contributed manner. Saying so, however; I am delighted receiving your feedback and is valid point.

<About the ultimate issue = resolved>

After experiments, I discovered that: as long as Month is dual value such as MonthName(), we do not need to use GetFieldSelections, but just field name is sufficient for Set Analysis purpose. This passes the concatenated months. So no need to use $::Month or others. This is quite a new discovery.