Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

dimension calculation

Hi All,

I am new to qlikview  i need your help on following issue .

I had date field   and want to know  how many days  for today .

i had achived this using today()- Date  where i am getting no.of days in between .

the  days field looks like as follows

1 4 6 7 8 11 15 17 20 27 33 40 46 50 .

And i  am using days dimension in a line chart.

My user wants  dimension values  as follows (using Days field )

<5  <10  <20  <40 <49 >50

Can you suggest me steps to achieve this .

Thanks

Uma ,

1 Solution

Accepted Solutions
Anil_Babu_Samineni

We can approach many ways

1) May be create field in Script Directly like

If(DaysField >=1 and DaysField <5, Dual('<5',1),

If(DaysField >=5 and DaysField <10, Dual('<10',2),

If(DaysField >=10 and DaysField <20, Dual('<20',3),

If(DaysField >=20 and DaysField <40, Dual('<40',4),

If(DaysField >=40 and DaysField <49, Dual('<49',5),

If(DaysField >=50 Dual('>50',1))))))) as FieldName


Note: You can use, Direct field as Dimension if you need


2) Class(DaysField, 10)

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

View solution in original post

5 Replies
Anil_Babu_Samineni

We can approach many ways

1) May be create field in Script Directly like

If(DaysField >=1 and DaysField <5, Dual('<5',1),

If(DaysField >=5 and DaysField <10, Dual('<10',2),

If(DaysField >=10 and DaysField <20, Dual('<20',3),

If(DaysField >=20 and DaysField <40, Dual('<40',4),

If(DaysField >=40 and DaysField <49, Dual('<49',5),

If(DaysField >=50 Dual('>50',1))))))) as FieldName


Note: You can use, Direct field as Dimension if you need


2) Class(DaysField, 10)

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
Kushal_Chawda

Kushal_Chawda

hi umakanth242

Using above approach, <5 bucket will give you days between (1 to 5), but <10 bucket will give you days between( 6 to 10, which is correct? don't you think it should also include 1 to 5?)

Not applicable
Author

Hi Kashal

For  <5  should  be >=0  to <5

<10  should be from >=5 to <10.

Similar  to renaming  as well

Thanks,

Uma

Not applicable
Author

Hi Anil

Thanks for helping  .