Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
akpofureenughwu
Creator III
Creator III

Filter Q from Quarter Field

Good day everyone,

  I have a design in my day field, I get day 1, day 2 ............. and day as well as Quarter. Q1,Q2.... and Q

I don't want day and Q in the respectively fields

How do I filter it.

Below is the script I used

LOAD *,

     Month(Date) as Month,

     WeekDay(Date) as WeekDay,

     'Week ' & Week(Date) as Week,

     Year(Date) as Year,

    'Q'& Ceil(Month(Date)/3) as Quarter,

    'Day '& Day(Date) as Day,

     Day(Date) as nDay;

Thanks

1 Solution

Accepted Solutions
tresesco
MVP
MVP

If you are getting a 'Q' without any number following that probably means some of your dates are not present or proper date. I would look into that issue first. However, to solve it in expression you could try like:


if( Isnum(Date), 'Q')& Ceil(Month(Date)/3) as Quarter,

View solution in original post

7 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

>>I don't want day and Q in the respectively fields

Then don't add them in your script...

    'Q'& Ceil(Month(Date)/3) as Quarter,

    'Day '& Day(Date) as Day,

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

Just omit the textual part like:

LOAD *,

     Month(Date) as Month,

     WeekDay(Date) as WeekDay,

     'Week ' & Week(Date) as Week,

     Year(Date) as Year,

    'Q'& Ceil(Month(Date)/3) as Quarter,

    'Day '& Day(Date) as Day,

     Day(Date) as nDay;

akpofureenughwu
Creator III
Creator III
Author

I have removed that line of script... 'Q' and 'Day'...

But the Q is now expressed in number ie 1,2,3 and 4 not Q1,Q2,Q3 and Q4

Same can be said of day..

Can I have the quarter expressed as Q1,Q2,Q3 and Q4..

Thank you for your response

tresesco
MVP
MVP

I am not sure if I understood you right. And I hope that you have understood what and how it happens when you remove/add 'Q' from/to the expression. If you want the 'Q' to be there for quarter, just leave the 'Q' there like:    


'Q'& Ceil(Month(Date)/3) as Quarter,

akpofureenughwu
Creator III
Creator III
Author

If I use this line of command: 'Q'& Ceil(Month(Date)/3) as Quarter, I will get the Q,Q1,Q2,Q3 & Q4 include the field

IF I use this line of command: Ceil(Month(Date)/3) as Quarter, I will get 1,2,3 & 4 in the quarter field


Is it not possible for me to get this Q1,Q2,Q3 and Q4 only?


Thanks for your response

tresesco
MVP
MVP

If you are getting a 'Q' without any number following that probably means some of your dates are not present or proper date. I would look into that issue first. However, to solve it in expression you could try like:


if( Isnum(Date), 'Q')& Ceil(Month(Date)/3) as Quarter,

akpofureenughwu
Creator III
Creator III
Author

Thank you Tresesco