5 Replies Latest reply: Nov 5, 2014 4:46 PM by Marco Wedel

# Calculated Field

Hi

Could anyone help me.

I have a dashboard and want to create a new field.

If the field Expense = "Income" then I want my field to have the value in the field "Category"

If the field Expense = "Direct" then I want my field to have the value in the field "Org_Unit"

If the field Expense = "Indirect" then I want my field to have the value in the field "Exp_Catt"

(This is my first Qlikview dashboard, so I will get better !!)

• ###### Re: Calculated Field

You can create below in your script

Value,

Expense,

If(Expense = 'Income', Value) as Category,

If(Expense = 'Direct', Value) as Org_Unit,

If(Expense = 'Indirect', Value) as Exp_Catt,

OtherFields....

From Souc

• ###### Re: Calculated Field

In the script you have something like:

...

Expense

...

From

...

Where

...

then transform it into:

...

Expense,

If(Expense = 'Income', 'Category',

If(Expense = 'Direct', 'Org_Unit',

If(Expense = 'Indirect', 'Exp_Catt', 'Undefined'

)

)

) as myNewField

...

From

...

Where

...

Let me know

• ###### Re: Calculated Field

Try this in chart's expression:

Pick(Match(GoodField, 'Income', 'Direct', 'Indirect'), 'Category', 'Org_Unit', 'Exp_Catt')

where good field is your field, see attached example.

• ###### Re: Calculated Field

Provide any sample file.

Regards

Anand

• ###### Re: Calculated Field

Pick(Match(Expense, 'Income','Direct','Indirect'), 'Category', 'Org_Unit','Exp_Catt') as [new field]

FROM anywhere;

• ###### Re: Re: Calculated Field

hope this helps

regards

Marco

• ###### Re: Calculated Field

just noticed my mistake.

Better try:

Pick(Match(Expense, 'Income','Direct','Indirect'), Category, Org_Unit, Exp_Catt) as [new field]

FROM anywhere;

hope this helps

regards

Marco

• ###### Re: Re: Calculated Field

like this:

```LOAD *,
Pick(Match(Expense, 'Income','Direct','Indirect'), Category, Org_Unit, Exp_Catt) as [new field];
Pick(Ceil(Rand()*3),'Income','Direct','Indirect') as Expense,
Ceil(Rand()*100) as Category,
Ceil(Rand()*100) as  Org_Unit,
Ceil(Rand()*100) as  Exp_Catt
AutoGenerate 20;
```

hope this helps ...

...finally

regards

Marco