11 Replies Latest reply: Apr 4, 2014 2:04 AM by pradeep t

# Calculated dimension if-sentence

Hello,

I have two Groups DBoardL and DboardG that include different fields.

Depending on the value of variable vP1 would I use one of the Groups,

but it doesn´t work. What do I do wrong?

if(vP1='21',DBoardL,DBoardG)

kindly

Håkan

• ###### Re: Calculated dimension if-sentence

Hi,

Verify that variable reflecting 21 or not?

Please post sample data or app for the expected solution.

• ###### Re: Calculated dimension if-sentence

Hello,

• ###### Re: Calculated dimension if-sentence

Hi Håkan

What do you mean by "doesn't work"? Is it always displaying DBoardG group as dimension?

Lukasz

• ###### Re: Calculated dimension if-sentence

It seems that group names can't be used in expression. Somebody correct me if I am wrong.

Update: I was trying with an alternative logic using 'Enable Conditional' taking two groups separately as dimension. Even that is not working.

• ###### Re: Re: Calculated dimension if-sentence

This was my first thought, but groups seem to 'almost' work in the expression (see attached)

• ###### Re: Calculated dimension if-sentence

If you notice carefully, the condition is not actually working on Groups but on fields.

• ###### Re: Calculated dimension if-sentence

No script is not correct you have to check the variable with field like check 21 with a field

let vP1 = 21;

if(Yourfield = \$(vP1),DBoardL,DBoardG)

Hope this helps

• ###### Re: Calculated dimension if-sentence

Hello,

What i suggest is you pull both the groups into dimension list and you can have the enable condition on both the groups like below.

if(vP1='21',1,0) for first Group and if(vP1<>'21',1,0) for second group.

Hope it helps.

Thanks & Regards,

Venkat T

• ###### Re: Calculated dimension if-sentence

Hello again,

the if sentence works, but the Groups are treated as a single Field. Only the first field

is used, no drill down is possible., as a stright table it works. I maybee have to create

two different charts and show them depending on the value of vP1.

• ###### Re: Re: Calculated dimension if-sentence

Yes, That's true

You won't get drilldown

• ###### Re: Calculated dimension if-sentence

We can achieve this by taking the 2 groups as 2 dimensions and applying the conditions to enable them.

1) Group1 dimension

V='1' (In enable condition )

2) Group 2 dimension

V<>'1' (In enable condition )

Note: Don't use the IF condition here.

See the same in the attachment. It is working fine for me.

Thanks