Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
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:

3 Replies
Highlighted
Not applicable

Re: Dimension - expression

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

Highlighted
Not applicable

Re: Dimension - expression

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

Thanks

Re: Dimension - expression

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.