Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do i split these data in a field into 2 different fields

Hello,

Find attached, I have in a field called "Month" Jan to Dec i want to split the first 6 months in a field and the next 6 month in another field. I want to put both in separate listbox.

Rgds

Ema

1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Hi,

If in the key fields there is always 1 for first 6 months and 2 for next months then add a new fields in the load script for the first and second months

LOAD

     key,

     Month,

     if(key=1,Month) as First6Month,

     if(key=2,Month) as Second6Month

FROM

split.xlsx

(ooxml, embedded labels, table is Sheet1);

And then you get

Next6months.png

Let me know any changes required

Regards

Anand

View solution in original post

4 Replies
ashfaq_haseeb
Champion III
Champion III

Hi,

Try like this

LOAD

     key,

     Date#(Month,'MMM') as Month,

      if(num(month((Date#(Month,'MMM'))))<=6,Month) as Month1,

      if(num(month((Date#(Month,'MMM'))))>6,Month) as Month2

FROM

split.xlsx

(ooxml, embedded labels, table is Sheet1);

Regards

ASHFAQ

Not applicable
Author

Thanks Ashfaq

What if the field is not in date format. what do we do?

ashfaq_haseeb
Champion III
Champion III

Hi,

We need to convert it into date using date#() Function as shown above.

If you have some sample data please upload it.

Regards

ASHFAQ

its_anandrjs
Champion III
Champion III

Hi,

If in the key fields there is always 1 for first 6 months and 2 for next months then add a new fields in the load script for the first and second months

LOAD

     key,

     Month,

     if(key=1,Month) as First6Month,

     if(key=2,Month) as Second6Month

FROM

split.xlsx

(ooxml, embedded labels, table is Sheet1);

And then you get

Next6months.png

Let me know any changes required

Regards

Anand