Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
cbaqir
Valued Contributor

Dual Replace Class Labels

My current dimension is:

=Dual(If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) <= 120, Class(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID), 60), '>120'),
If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) <= 120, Class(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID), 60), 120))

and it gives me these labels:

3-3-2016 7-44-23 AM.jpg

My customer wants the labels to display (and then sort the same way) more simply:

<60

60-120

>120

I've been playing with the Dual Replace function in the dimension but can't get it to work correctly.

Thanks.

Tags (4)
1 Solution

Accepted Solutions

Re: Dual Replace Class Labels

May be this:

=Dual(

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) < 60, '<60',

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) > 120, '>120',

     Replace(Class(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION),REQUEST_ID), 60), '<= x <', '-'))),

    

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) < 60, 0,

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) > 120, 120,

     Class(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION),REQUEST_ID), 60))))


Capture.PNG

View solution in original post

10 Replies
Partner
Partner

Re: Dual Replace Class Labels

Hi,

Can you possibly attached sample file?

This help

cbaqir
Valued Contributor

Re: Dual Replace Class Labels

Added to original post.

Re: Dual Replace Class Labels

May be this:

=Dual(

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) < 60, '<60',

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) > 120, '>120',

     Replace(Class(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION),REQUEST_ID), 60), '<= x <', '-'))),

    

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) < 60, 0,

     If(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION), REQUEST_ID) > 120, 120,

     Class(Aggr(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION),REQUEST_ID), 60))))


Capture.PNG

View solution in original post

cbaqir
Valued Contributor

Re: Dual Replace Class Labels

Perfect! Thanks, Sunny!

MVP
MVP

Re: Dual Replace Class Labels

You can use below one also

=Aggr(

  If(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION)< 60, Dual('<60',1),

  If(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION)>= 60 and Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION) <= 120, Dual('60-120',2),

  If(Sum({<Flag_CurrentStep={1}>}WORKFLOW_DURATION)> 120, Dual('>120',3))))

  ,REQUEST_ID)

cbaqir
Valued Contributor

Re: Dual Replace Class Labels

So to apply the same logic to this version:

=Dual(
If(WORKFLOW_DURATION <= 120,
Class(WORKFLOW_DURATION, 60), '>120'), 
If(WORKFLOW_DURATION <= 120,
Class(WORKFLOW_DURATION, 60), 120))

would it be something like this:

=Dual(
If(WORKFLOW_DURATION) < 60, '<60',
If(WORKFLOW_DURATION) > 120, '>120',
Replace(Class(WORKFLOW_DURATION)), 60), '<= x <', '-'
),
If(WORKFLOW_DURATION) < 60, 0,
If(WORKFLOW_DURATION) > 120, 120,
Class(WORKFLOW_DURATION), 60
)

Re: Dual Replace Class Labels

Some missing parenthesis:

=Dual(
If(WORKFLOW_DURATION) < 60, '<60',
If(WORKFLOW_DURATION) > 120, '>120',
Replace(Class(WORKFLOW_DURATION)), 60), '<= x <', '-'))),
If(WORKFLOW_DURATION) < 60, 0,
If(WORKFLOW_DURATION) > 120, 120,
Class(WORKFLOW_DURATION), 60
))))

cbaqir
Valued Contributor

Re: Dual Replace Class Labels

That's giving me "Error in calculated dimension"

Re: Dual Replace Class Labels

And you had some extra parenthesis elsewhere:

=Dual(

If(WORKFLOW_DURATION < 60, '<60',

If(WORKFLOW_DURATION > 120, '>120',

Replace(Class(WORKFLOW_DURATION, 60), '<= x <', '-'))),

If(WORKFLOW_DURATION < 60, 0,

If(WORKFLOW_DURATION > 120, 120,

Class(WORKFLOW_DURATION, 60))))