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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Question on List box expression

Hi -

This is a simple question, with I hope a simple answer.  I have a Master Calendar with a Trade_Calendar_Quarter column.  It is 1, 2, 3, or 4 depending upon in which quarter the date falls.  I can create a list box with that column in it, and it shows 1, 2, 3, and 4, as expected.  I wanted it to look nice, so I made it an expression:

='Q' & Trade_Calendar_Quarter

With that as the expression, it shows Q, Q1, Q2, Q3, and Q4.  The Q is grayed out, as it is not possible.

So the question is really two questions: why does that happen, and how can I not have the Q show up?

Labels (1)
1 Solution

Accepted Solutions
nilo_pontes
Partner - Creator
Partner - Creator

Blair, try the Dual function.

i.e.: Dual('Q' & Trade_Calendar_Quarter,Trade_Calendar_Quarter)

Best regards

View solution in original post

16 Replies
venkatg6759
Creator III
Creator III

You have hide excluded  in properties of that list box if you don't want to show Q .

It was not showed you just made an expression at front end .

Not applicable
Author

Hi,

Use this in your master calendar:

Ceil(Month(DateField)/3) AS Quarter,

Best regards.

maxgro
MVP
MVP

=if(len(trim(Trade_Calendar_Quarter))=0, null(), 'Q' & Trade_Calendar_Quarter)

Not applicable
Author

I'm afraid I've tried that, and it doesn't work.

venkatg6759
Creator III
Creator III

Try to follow Oswaldo reply  that might work .

Not applicable
Author

This does work, but it seems very strange that if there are no values in the calendar for that column other than 1, 2, 3, and 4 that it would be necessary.  Why does concatenating the 'Q' seem to create a 'new' value?

Not applicable
Author

This would just give me 1, 2, 3, and 4.  I already have that.  It's the concatenation of 'Q' that is causing the problem.

Not applicable
Author

Hi,

I suggest extract Quatrer from a valid Date Field (no nulls)  to make sure get correct data if you have nulls, specify a number like a default value ( if(isnull(MyField),1,MyField) ) and use it in your formula.

Something like this:

Ceil(Month( if(isnull(MyField),1,DateField) )/3) AS Quarter,

or

Q & '-' &if(isnull(QuarterField),1,MyField) as Quarter

Best regards.

Not applicable
Author

The second expression works.  However, so does just this:

'Q-' & Trade_Calendar_Quarter as Quarter

Why does this work in the load script but not in the expression on the list box?  Why does the list box seem to introduce a null/empty value that isn't really there?