Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

create a bucket function

hi i have years of experience and employees can any one help me in creating a bucket function so that i can put it like 0-10 years then 10-20, 20-30, 30-40. on a block chart

7 Replies
sunny_talwar

May be create a field in the script or create it as a calculated dimension:

If(YearExperience < 10, Dual('0-10', 1),

If(YearExperience < 20, Dual('10-20', 2),

If(YearExperience < 30, Dual('20-30', 3),

If(YearExperience < 40, Dual('30-40', 4))))

Not applicable
Author

hi sunny but its not working

sunny_talwar

Where are you doing this? Script or calculated dimension? Can you share a sample where it isn't working?

Not applicable
Author

i am doing on calculated dimensions

sunny_talwar

Can you share the expression you are using?

ziadm
Specialist
Specialist

use Class function

let vWidth = 10 ;

=dual(replace(Class(Age,$(vWidth)),'<= x <','to'),Class(Age,$(vWidth)))



pho3nix90
Creator II
Creator II

Ziads code would be the better solution. However if you are using it straight in a chart do

=dual(replace(Class(Age,10),'<= x <','to'),Class(Age,10))