Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

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

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;

View solution in original post

14 Replies
Partner
Partner

Hi

KeySales:

Load

     Key,

     Sum(Sales) AS KeySales

Resident Sample_Int

Group by Key;

Mark

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;

View solution in original post

Master
Master

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.

Creator II
Creator II

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

Partner
Partner

Hi,

If it was helpful can you mark is so

Many Thanks

Creator II
Creator II

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

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;

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

Creator II
Creator II

15 and 20