Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
mendoncart
New Contributor III

Getfieldselection Date Value

Hi guys.

I'm trying to get the selection of a filter with an auto calendar field: [DocDate.autoCalendar.YearMonth]

The thing is, if I use GetFieldSelections([DocDate.autoCalendar.YearMonth]), it appears to return a text value, and not a date one.

I need to get a date value to use the selected date into expressions, but I'm not being able to even convert the result in a MM/DD/YYYY type of date.

Can you guys help me how to get the date selected on the field, resulting a date value type?

Thanks in advance!

1 Solution

Accepted Solutions
Highlighted
mendoncart
New Contributor III

Re: Getfieldselection Date Value

I've made it!

Thank you Sunny Talwar for your help and attention!

For whom may be interest to the solution, is just use date#(GetFieldSelections(YourDateField), 'YourDateFieldFormat').

In my case, I get the result 2016-Dec off GetFieldSelections, so this solves it:

date#(GetFieldSelections([DocDate.autoCalendar.YearMonth]),'YYYY-MMM')

View solution in original post

7 Replies
Highlighted

Re: Getfieldselection Date Value

How exactly are you looking to use this? Are you hoping to select multiple YearMonths at a time or just a single value? If it is single, then you can use Only([DocDate.autoCalendar.YearMonth])

Highlighted
mendoncart
New Contributor III

Re: Getfieldselection Date Value

This kinda works. But the thing is, I'm using this in a pivot table, and some of the values of the dimension doesn't have this field, or have a different value. So I need this selection value to use and compare with others value that I get.

And yes, I'll be selecting only one value.

Highlighted

Re: Getfieldselection Date Value

Can you share an example of what you are doing?

Highlighted
mendoncart
New Contributor III

Re: Getfieldselection Date Value

I'm comparing how much time since the last customer purchase.

So, I have a pivot table with some data, including the last purchase date.

But I'm having a problem:

     Since I'm using {1} in set analysis in the expression of the last purchase date, some times I get a date after the selected period. Lets say I've selected 2016-Dec, I want the last purchase date to be at the period selected or before it. So I need the month end of the selected period (12/31/2016) to use in set analysis as a limiter.

Highlighted

Re: Getfieldselection Date Value

I guess you don't want to use {1} or may be use one, but allow for dates to be changed... but I am not entirely sure what fields you have and what exactly are you desiring to see. Would you be able to share a sample qvf?

Highlighted
mendoncart
New Contributor III

Re: Getfieldselection Date Value

I've made it!

Thank you Sunny Talwar for your help and attention!

For whom may be interest to the solution, is just use date#(GetFieldSelections(YourDateField), 'YourDateFieldFormat').

In my case, I get the result 2016-Dec off GetFieldSelections, so this solves it:

date#(GetFieldSelections([DocDate.autoCalendar.YearMonth]),'YYYY-MMM')

View solution in original post

Highlighted

Re: Getfieldselection Date Value

May be this?

If(GetFieldSelections([DocDate.autoCalendar.YearMonth]) > 0, Sum({<[DocDate.autoCalendar.YearMonth] = {'$(=MonthEnd(GetFieldSelections([DocDate.autoCalendar.YearMonth])))'}>}Sales),'NA')

Or it may issue with Format, First you can convert into Month and then Try same

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)