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: 
Not applicable

How to select certain data from a dimension and create them as a new dimension? Thanks

Hi,

I'm very new to Qlik SENSE and would really appreciate the help that I can get, thanks.

Basically, I have a field known as 'DELIVERY_DATE' which consists of Jul 2013, Aug 2013, Sep 2013 ....... up to Mar 2015, Apr 2015 and May 2015.

I would like to create a new field out of it to use it as a dimension, let's call it 'DELIVERY_DATE 2014-2015', which will only consist of July 2014, Aug 2014 up to May 2015.

For your info, I did try to use the wildmatch and pick syntax within my if statement and I almost got it except the fact that the false expression is also present within my new dimension which I don't desire.

Can someone please shed some light upon it, thanks!

8 Replies
Gysbert_Wassenaar

Perhaps like this:

LOAD *, If(DELIVERY_DATE >= makedate(2014,7) and DELIVERY_DATE < makedate(2015,6), DELIVERY_DATE]) as [DELIVERY_DATE 2014-2015]

LOAD

     date(date#(DELIVERY_DATE,'MMM YYYY'),'MMM YYYY') as DELIVERY_DATE ,

     ...other fields...

FROM ...source...

;


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

LOAD  *,

     If(DELIVERY_DATE >= Makedate(2014,7) and DELIVERY_DATE <= Makedate(2015, 6, 30), DELIVERY_DATE]) as [DELIVERY_DATE_2014-2015] 

FROM DataSource;

Regards,

Jagan.

djallelsadki
Partner - Creator
Partner - Creator

Hello,

Try this :

LOAD *,

If(right(DELIVERY_DATE,4)=2014 OR right(DELIVERY_DATE,4)=2015,DELIVERY_DATE) as [DELIVERY_DATE_2014-2015]

FROM Datasource;

Best regards,

D.Sadki

Not applicable
Author

Thanks for that Gysbert, appreciate the help.

Not applicable
Author

Thanks for that jagan, that was really helpful. Cheers.

Not applicable
Author

Hey Djallel, that really helps! Thanks for that.

Anonymous
Not applicable
Author

I assume that you need last 11 months rather than from fixed "July 2014" to fixed "May 2015", that is you don't want to change script every month.
If my guess is correct, you can use this:

if(DELIVERY_DATE >= monthstart(today(),-10) AND DELIVERY_DATE <= monthend(today()), DELIVERY_DATE) as "Delivery Date Last 10 Months"

Not applicable
Author

Yup, spot on. Thanks Michael!