Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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;
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.
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.
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.
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