Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

How to create a new field as below

Hi,

I'm using Sol_Flag as calculated dimension. It has three filters - Created, Reused and Updated. But I need values In Stacked Bar chart only for Created and Reused. If am using Cal dimension as =if ( Sol_flag =' Created' or 'Reused', Sol_flag, null()), QA will not pass. As QA person said better to avoid using Cal Dimension always. The other way is I should create a new field in script as below

=if ( Sol_flag =' Created' or 'Reused', Sol_flag, null()) as Sol_flag1. How to create this field in script. If am creating by keeping the Sol_flag as original and next line as new field, am getting error - Sol_flag field not found.

Please provide some insights on how to achieve this.

Thank you in Advance.

Regards

Velan

4 Replies
vishalwaghole
Valued Contributor II

Re: How to create a new field as below

Use set analysis, which is best possible solution either scripting.

Set analysis should be like,

= count({<Sol_flag = {'Created','Reused'}>} Column)

Just select Dimension whatever you want. Go to Next and right expression as like above set analysis.

depending on you KPI you can count or sum or whatever is your requirement,

I have only shown one example. Bold one is set analysis.

Hope this will work.

-- Regards,

Vishal Waghole 

Not applicable

Re: How to create a new field as below

Why don't you use set analysis in your expressions for chart.

sum({<Sol_Flag = {Reused,Created}>}sales)

The new line should be like :

if(Sol_flag = 'Created' or Sol_flag = 'Reused', Sol_flag,null()) as Sol_flag1

Another thing i observed is the case of your flag, you started with Sol_Flag and you are using as Sol_flag

Thanks,

Angad

MVP
MVP

Re: How to create a new field as below

Hi

During the load of the table containing Sol_Flag:

LOAD....

     if (Sol_flag =' Created' or Sol_flag = 'Reused', 1, 0) as Sol_flag1,

     ....

Note that Sol_Flag and Sol_flag are NOT the same; QV field names (and table names) are case sensitive.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MVP
MVP

Re: How to create a new field as below

in the script you can (example)

- copy the lines for Sol_flag creation and replace the Updated with null()

t:

load

  ...,

  Dim1,

  if(Dim1='A', 'Created', if(Dim1='B', 'Reused', 'Updated')) as Sol_flag,

  if(Dim1='A', 'Created', if(Dim1='B', 'Reused', null())) as Sol_flag1 ,

  .............

Resident

  sometable;

     

- or use preceding load (n load, from bottom)

t:

load          // second load, can use the fields of first load

  *,

  if(match(Sol_flag, 'Created', 'Reused'), Sol_flag, null()) as Sol_flag1;

load          // first load

  ...,

  Dim1,

  if(Dim1='A', 'Created', if(Dim1='B', 'Reused', 'Updated')) as Sol_flag,

   ............

Resident

  sometable;

Community Browser