Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create New Dimension of Available ِData

hello dears

i want create Dimension  of Available ِData

i want Create New Dimension That Have 2 Record ,Item1 and Item 2

Item 1 Filter Data Between 01/01/2014 to 06/01/2014

And Item 2 Filter Data Between 07/01/2014 to 07/05/2014

plz help me

Pic.png

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Best way is to create that field in the script:

LET Start = num(makedate(2014,1,1));

LET End = num(makedate(2014,5,30));

LET NumOfDays = End - Start + 1;

k_tmp:

load

  $(Start) + Rowno()-1 as dateTMP

AutoGenerate $(NumOfDays);

k:

LOAD *,

  if(Activation_date >= makedate(2014,1,1) and  Activation_date <= makedate(2014,1,6), 'Item1',

  if(Activation_date >= makedate(2014,1,7) and  Activation_date <= makedate(2014,5,7), 'Item2')) as Item;

load

  Date(dateTMP) as Activation_date,

    Year(dateTMP) as Year,

    Month(dateTMP) as Month,

    Day(dateTMP) as Day,

    WeekDay(dateTMP) as WeekName,

    Week(dateTMP) as Week,

    Month (dateTMP) &'-'&Year (dateTMP) as MMYYYY

Resident k_tmp;

DROP Table k_tmp;

If you don't like that then you can try an expression for the listbox:

=if(Activation_date >= makedate(2014,1,1) and  Activation_date <= makedate(2014,1,6), 'Item1',

  if(Activation_date >= makedate(2014,1,7) and  Activation_date <= makedate(2014,5,7), 'Item2'))


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Best way is to create that field in the script:

LET Start = num(makedate(2014,1,1));

LET End = num(makedate(2014,5,30));

LET NumOfDays = End - Start + 1;

k_tmp:

load

  $(Start) + Rowno()-1 as dateTMP

AutoGenerate $(NumOfDays);

k:

LOAD *,

  if(Activation_date >= makedate(2014,1,1) and  Activation_date <= makedate(2014,1,6), 'Item1',

  if(Activation_date >= makedate(2014,1,7) and  Activation_date <= makedate(2014,5,7), 'Item2')) as Item;

load

  Date(dateTMP) as Activation_date,

    Year(dateTMP) as Year,

    Month(dateTMP) as Month,

    Day(dateTMP) as Day,

    WeekDay(dateTMP) as WeekName,

    Week(dateTMP) as Week,

    Month (dateTMP) &'-'&Year (dateTMP) as MMYYYY

Resident k_tmp;

DROP Table k_tmp;

If you don't like that then you can try an expression for the listbox:

=if(Activation_date >= makedate(2014,1,1) and  Activation_date <= makedate(2014,1,6), 'Item1',

  if(Activation_date >= makedate(2014,1,7) and  Activation_date <= makedate(2014,5,7), 'Item2'))


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks This is Correct

Do you Can Implement Without change edit Script ,

Implement In ListBox Expression ,I am not allowed change edit script

PrashantSangle

Hi,

Create List box with expression and write if statement as suggested by Gysbert.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂