Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
caccio88
New Contributor III

Create a dimension in load script

Hi everyone,

maybe is trivial issue but i'm wondering to create calculated dimension in my script.

I'm able to create calculated dimension with simple formulas like in my attachment but i don't know how to create dimension a little bit complex.

As you can see here i created the "key" dimension and now i can calculate the value of sales for the dimension...but if i want to create a dimension that is "sales per key" how should i do??

Clear enough?

Thank u all.

sunindia‌ what do u think about it?

Messaggio modificato da Filiberto Cacciari Hi guys, i've attached also my qvw cause i've a new little problem. Now I display the sum of KeySales but I want that when the value of sales is the same it will be sum once. Sample_Int: LOAD * INLINE [ Dim1, Dim2, Dim3, Sales A, B, C, 10 A, B, C, 10 A, B, C, 5 A, B, C, 5 C, B, A, 15 C, B, A, 15 C, B, A, 5 ]; Sum(ABC) = 15 and not 30 Sum(CBA) = 20 and not 35

1 Solution

Accepted Solutions

Re: Create a dimension in load script

Just a minor change. Resident should be from Sample, instead of Sample_Int

KeySales:

Load

    Key,

    Sum(Sales) AS KeySales

Resident Sample

Group by Key;

14 Replies
mark6505
Valued Contributor III

Re: Create a dimension in load script

Hi

KeySales:

Load

     Key,

     Sum(Sales) AS KeySales

Resident Sample_Int

Group by Key;

Mark

Re: Create a dimension in load script

Just a minor change. Resident should be from Sample, instead of Sample_Int

KeySales:

Load

    Key,

    Sum(Sales) AS KeySales

Resident Sample

Group by Key;

effinty2112
Honored Contributor

Re: Create a dimension in load script

Hi Filiberto,

I wouldn't use the phrase Calculated Dimension for the Key you made in your script because after you load this the field 'Key' will exist in the data model as a dimension, it will not need to be calculated in a chart.

A good tip would be to separate the components of your key with an uncommon character that isn't used in any of the concatenated fields. So instead of the line

Dim1 & Dim2 & Dim3 as Key,

so 'dog' & 'cat' & 'mouse' = 'dogcatmouse' = 'dogc' & 'atm' & 'ouse'

Try

Dim1 & '|' & Dim2 & '|' & Dim3 as Key,


'dog' & '|' & 'cat' & '|' & 'mouse' = 'dog|cat|mouse'  <> 'dogc' & '|' & 'atm' & '|' &'ouse'


Hope this is useful.

caccio88
New Contributor III

Re: Create a dimension in load script

Thank you all for your contribute. I've definitely solved my issue. Mark6505 sunindiaEffinty2112

mark6505
Valued Contributor III

Re: Create a dimension in load script

Hi,

If it was helpful can you mark is so

Many Thanks

caccio88
New Contributor III

Re: Create a dimension in load script

Hi Guys,

I've a new issue as you can see.

Sample_Int:

LOAD * INLINE [

    Dim1, Dim2, Dim3, Sales

    A, B, C, 10  

    A, B, C, 10

    A, B, C, 5

    A, B, C, 5

    C, B, A, 15

    C, B, A, 15

    C, B, A, 5  

];

Sum(ABC) = 15 and not 30

Sum(CBA) = 20 and not 35


sunindiaMark6505‌  Effinty2112

Re: Create a dimension in load script

Hi,

May be use the DISTINCT

Like

Sample_Int:

Load Distinct *,Dim1&Dim2&Dim3 as Key;

LOAD * INLINE [

    Dim1, Dim2, Dim3, Sales

    A, B, C, 10 

    A, B, C, 10

    A, B, C, 5

    A, B, C, 5

    C, B, A, 15

    C, B, A, 15

    C, B, A, 5 

];

KeySales:

Load Key,

    Sum(Sales) AS KeySales

Resident Sample_Int

Group by Key;

Re: Create a dimension in load script

You want it to show 15 and 20 or 30 and 35?

caccio88
New Contributor III

Re: Create a dimension in load script

15 and 20

Community Browser