Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dimension - expression

hello,

I need your help to solve this issue.

The segment is a Dimension expression  of extraction the first 2 letters from a code

I can not do the same with the PY...

segmentCYPY
719770
PO142770
MD55770
CA205770
DE75770
LO59770
FA87770
PA11770
NR7770
LU44770
MG13770
FO21770

 

Thanks

Attached the example:

Labels (1)
3 Replies
Not applicable
Author

Your tables all were disconnected and you need to modify your script. Try like below:

Data:

LOAD CODE_CY AS CODE,

     [Current Day]

FROM

C:\Users\vera\Desktop\Datos.xls

(biff, embedded labels, table is cd$);

Join(Data)

LOAD CODE_PD AS CODE,

     [Previous Day]

FROM

C:\Users\vera\Desktop\Datos.xls

(biff, embedded labels, table is pd$);

Join(Data)

LOAD CODE_PW AS CODE,

     [Previous Week]

FROM

C:\Users\vera\Desktop\Datos.xls

(biff, embedded labels, table is pw$);

Join(Data)

LOAD CODE_PY AS CODE,

     [Previous Year]

FROM

C:\Users\vera\Desktop\Datos.xls

(biff, embedded labels, table is py$);

So you will get only one table.

Use Dimension: Left(CODE,2)

Expression: Sum(Current_Day) etc

Not applicable
Author

Thanks, the problem is that i can not touch the script. I can just do free analysis...

Thanks

sunny_talwar
MVP
MVP

May be this:

=Sum(Aggr(If(Left(CODE_CY, 2) = Left(CODE_PD, 2), [Previous Day], 0), CODE_CY, CODE_PD))

Capture.PNG

But remember the performance will be very poor because you are essentially creating a Cartesian Product with your Aggr() function.