Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
caccio88
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

14 Replies
sunny_talwar

Settu's script is working:

Capture.PNG

caccio88
Creator II
Creator II
Author

How about this:

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   
]; 
Sample:
load
Dim1,
Dim2,
  Dim3,
  Dim1&Dim2&Dim3 as Key,
   Sales
Resident Sample_Int;

   

KeySales: 
Load Key, 
    Sum(distinct Sales) AS KeySales 
Resident Sample 
Group by Key;
sunny_talwar

Alternatively, this should also work:

Sample_Int: 

Load *,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(DISTINCT Sales) AS KeySales 

Resident Sample_Int 

Group by Key;

caccio88
Creator II
Creator II
Author

Yep. Like what I've posted moment ago. thx all of you

sunny_talwar

Ya, I think it should work (like I mentioned below)