Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Concatenation in script

Hi,

i may be missing something very basic here but i do not understand why the line of code commented in red is giving blank results, why are the brackets crucial here?

Many thanks for any advice.

regards,

Artur

Buckets:

LOAD

Day,

(floor(Day/30)*30+1) & ' - ' & (floor(Day/30)*30+30) as Bucket,

floor(Day/30)*30+1  & ' - ' &  floor(Day/30)*30+30  as Bucket2 //why is this one without brackets not working??

;

LOAD

recno() as Day

autogenerate 100;

1 Solution

Accepted Solutions
kamal_sanguri
Specialist
Specialist

Hi Artur,

The reason why you are not getting the values in Bucket2 is quite straightforward but a bit tricky to understand.

If you only remove '+30' from your expression, you will get values under it

    floor(Day/30)*30+1  & ' - ' &  floor(Day/30)*30  as Bucket2


Now, Let's see why this is happening.


OK, Let's do it otherway. I am adding a qlikview document to make it easier to understand.


Let me know, if it is helpful.



View solution in original post

3 Replies
Anil_Babu_Samineni

The reason is here, Without indicating anything it wont work. Because as per Mathematics agenda or algorithm it won't understand to club 2 values in single value. That is how the Parenthesis works in Qlikview and it can split into two values and the separated work as Single value by mid of Hyphen. And Parenthesis can consider as one Value and Second value then we are clubbing into one by using Hyphen.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
kamal_sanguri
Specialist
Specialist

Hi Artur,

The reason why you are not getting the values in Bucket2 is quite straightforward but a bit tricky to understand.

If you only remove '+30' from your expression, you will get values under it

    floor(Day/30)*30+1  & ' - ' &  floor(Day/30)*30  as Bucket2


Now, Let's see why this is happening.


OK, Let's do it otherway. I am adding a qlikview document to make it easier to understand.


Let me know, if it is helpful.



Anonymous
Not applicable
Author

Thank you both for explaining this to me.

I liked the app attached so I am marking Kamal's answer as Correct answer.

But... strangely such a formula works perfect in excel without the extra brackets:

=FLOOR((A30-1)/30,1)*30+1 &"-"& FLOOR((A30-1)/30,1)*30+30

By the way, I noticed that my buckets were not working fine for day 30, 60, 90...(multiplications of 30) so I had to subtract 1 from the Day value.

regards,

Artur