Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

If-Function / Simples Question

Dear All,

How i can create an expression to define a Column Title based in a conditional.

Sample that i have tryed, but without success:

CROSSTABLE ([Brand], [Quantity], 2)

LOAD

F1 as PRODUCT,

BRAND1,

BRAND2,

IF(PRODUCT="TLB", BRAND3, OTHERS)

FROM....

Thanks for any reply

Danilo

10 Replies
IAMDV
Honored Contributor II

If-Function / Simples Question

Danilo,

Please try this...

IF(PRODUCT='TLB', 'BRAND3', 'OTHERS') AS PRODUCT

Cheers - DV

Not applicable

If-Function / Simples Question

D V,

Thanks for your reply, but not is this...

Look my complete code...if you see any problem, please tell-me.

ps.: without conditional, loads run =/

[FlashAux]:

CROSSTABLE([Brand], [Quantity],2)

LOAD

  F1      AS [Product],

  makedate($(ano),$(mes)) AS [Date],

[BRAD 1],

BRAND2,

IF(Product='TLB','BRAND3', 'OTHERS') as Product,

BRAND4,

BRAND5,

BRAND6,

BRAND7,

BRAND8,

BRAND9,

OTHERS

FROM [Flash Market\Flash$(var).xls]...

Tks

Danilo

IAMDV
Honored Contributor II

If-Function / Simples Question

What is the error message? Instead of Product, have you tried using F1 in the function condition. I mean you can't use the alias name with the same load script.

Cheers - DV

Not applicable

If-Function / Simples Question

DV,

as you have oriented, i need use F1 instead of Product.

But another problem was appeared.

The field was loaded into different table. For it should have been loaded at Brands along with Brand4, 5 and so on, but was loaded in Quantity.

What to do?

Thanks again

Not applicable

If-Function / Simples Question

Danilo,

I think what you want to do is change your If statement to: IF(F1 = 'TLB','BRAND3','OTHERS') as Brand3.

F1 has yet to be renamed to Product when your if statement executes so you need to reference it as it is in the excel file.

Now, does Brand1-9 exist as fields in the xls file?

IAMDV
Honored Contributor II

If-Function / Simples Question

Is it possible for you to share the QV document?

Cheers - DV

IAMDV
Honored Contributor II

If-Function / Simples Question

I think Leonard is right. figures crossed that should resolve the issue.

Cheers - DV

Not applicable

If-Function / Simples Question

Unfortunally i can't share the QV file, because not is mine..

But the problem now, is:

My conditional was filling the table Quantity insteat of Brand.

I tryed change this:

CROSSTABLE

([Brand], [Quantity],2)

to

------

CROSSTABLE(if([Brand]='BRAND3' and [Product]='TLB', 'BRAND3','OTHERS'), [Quantity],2)

Tks again

-----

Not applicable

If-Function / Simples Question

Could you provide a better layout of your source data at least for us? Also, what end result are you trying to achieve? What is the purpose of having each Brand in its own column within the source data? Could that be better accomplished in the chart itself?

Community Browser