Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding a calculated field to a dimension

Hi Everybody

I have this data-set where I have some dimensions. Within one of those dimensions I want add a calculated field, based on two fields in that dimension.

Please se attached example. Trying to do it with Left Join and Resident in the script function.

Is it possible in any way?

Regards

Stefan

1 Solution

Accepted Solutions
Kushal_Chawda

try this

Dimension:

=ValueList('Pages','Revenue','Rev per page')


Expression:

=Pick(match(ValueList('Pages','Revenue','Rev per page'),'Pages','Revenue','Rev per page'),

sum({<Type={'Pages'}>}Amount),

sum({<Type={'Revenue'}>}Amount),

sum({<Type={'Pages'}>}Amount)/

sum({<Type={'Revenue'}>}Amount))

View solution in original post

12 Replies
Anonymous
Not applicable
Author

So basically I want to add another field under the dimension "Type", which is called "Rev per page".

Kushal_Chawda

Create synthetics dimension using valuelist function or create inline table

Data:

LOAD Media,

    Type,

    Month,

    Amount

FROM

C:/example.xlsx

(ooxml, embedded labels, Table is Ark1);

Type:

load * inline [

TypeNew

Pages

Revenue

Rev per page

];


Create chart


Dimension:

TypeNew


Expression:

Pick(match(TypeNew,'Pages','Revenue','Rev per page'),

sum({<Type={'Pages'}>}Amount),

sum({<Type={'Revenue'}>}Amount),

sum({<Type={'Pages'}>}Amount)/

sum({<Type={'Revenue'}>}Amount) )


Anonymous
Not applicable
Author

Hi Kushal

Either I'm doing something wrong or it's not working.

When I'm Copying above script into my qvd file, it doesn't give me the right answer.

It just says "Error in calculation" and just Sum alle the numbers.

Regards

Stefan

Anonymous
Not applicable
Author

I have been trying to figure what I'm doing wrong, but I can't seem figure it out.

Anyone else got some ideas how to solve this?

Regards

Stefan

qlikview979
Specialist
Specialist

Can you please share sample app.

Anonymous
Not applicable
Author

Hej Mahesh

Please see attached

Regards

Stefan

qlikview979
Specialist
Specialist

can you please share the  sample source  file.

Kushal_Chawda

try this

Dimension:

=ValueList('Pages','Revenue','Rev per page')


Expression:

=Pick(match(ValueList('Pages','Revenue','Rev per page'),'Pages','Revenue','Rev per page'),

sum({<Type={'Pages'}>}Amount),

sum({<Type={'Revenue'}>}Amount),

sum({<Type={'Pages'}>}Amount)/

sum({<Type={'Revenue'}>}Amount))

Anonymous
Not applicable
Author

Yes of course