Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator III

Dates

Hi,

I created a composite key with fields as Enterdate &'_'& Centernum as %key and then i drop the field EnterDate,

but i need to use the date field in the front end expression may i know how to fetch only date field from %key.

I tried this ...date(date#(left(%key,10),'MM/DD/YY')

9 Replies
sunny_talwar

Try this:

Date(Date#(SubField (%key, '_', 1), 'MM/DD/YY'))

Assuming your Enterdate was in the format 'MM/DD/YY'

MK_QSL
MVP
MVP

It depends on how your Enterdate format...

Considering your Enterdate is having MM/DD/YY format, you need to use as below

Date(Date#(Left(%key,8),'MM/DD/YY'))

In case the format is MM/DD/YYYY use below

Date(Date#(Left(%key,10),'MM/DD/YYYY'))

jonathandienst
Partner - Champion III
Partner - Champion III

Is your date 8 characters or 10? Match the date format with the number of characters you are trimming with left().

But if you need the date in the front end, why do you drop EnterDate?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sunny_talwar

Since you are using Left(%Key), it seems that Enterdate might be MM/DD/YYYY. If that is true, you can try this:

Date(Date#(SubField (%key, '_', 1), 'MM/DD/YYYY'))

nareshthavidishetty
Creator III
Creator III
Author

Hi, But my %key contains fields like this,because of that i didn't get the dates,any suggestions please

1.png

sunny_talwar

Try this in the script:

Date#(SubField(%key, '-', 1), 'MM/DD/YYYY') as Date

Try this as a dimension:

Date#(SubField(%key, '-', 1), 'MM/DD/YYYY')

sasiparupudi1
Master III
Master III

Try

Date#(KeepChar(%key,'0123456789/'), 'MM/DD/YYYY')

or

Date#(KeepChar(%key,'0123456789/'), 'DD/MM/YYYY')

nareshthavidishetty
Creator III
Creator III
Author

Hi,

While writing the expression i got nothing actually i am struck at the flower braces which i got error,can you guide me on that2.png

sasiparupudi1
Master III
Master III

Hi Naresh,

You can not have expressions on the left side of your set analysis like how you are trying to do..

Please take the suggestion of Jonathan  and keep your date filed(EnterDate? ) in your base data model so that you could easily filter the data in the front end.

hth

Sasi