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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Add More Values within same Calculated Column

Hi All,

Below is a Sample Data i have:

NamesValuesValues2
jk89121020
Nami001-100
mo02420004000
hon343-50
brt11025005000

Output that i want

NamesValues
jk891212
Nami00150
mo0242000
hon34325
brt1102500

How to Calculate only Rows that are Null and Assign 50% of a number we get on (Values2 Column), and it must not affect existing Numbers under (Values column).

14 Replies
swuehl
MVP
MVP

Maybe like

LOAD Names,

       if(len(trim(Values)), Values, [Values2] / 2) as Values

FROM YourTableSource;

sinanozdemir
Specialist III
Specialist III

I think you can do it like this:

If(Len(Values) > 0, Values, Values ÷ 2)

Hope this helps.

Anonymous
Not applicable
Author

Hi,

only a thing, you want 50% of Value2 column onl if the column 1 is null but in your output the first row is 12.

This should is 10?

Please explain.

Reagrds

MayilVahanan

Hi

Try like this

LOAD Names, If(Len(Trim(Values))=0, Values2/2, Values) as Values, Values2 INLINE [

    Names, Values, Values2

    jk8912, 10, 20

    Nami001, , 100

    mo024, 2000, 4000

    hon343, , 50

    brt110, 2500, 5000

];

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
sunny_talwar

Try this script:

Table:

LOAD *,

  If(Len(Trim(Values)) > 0, Values, 0.5* Values2) as [New Values];

LOAD Names,

    If(IsNum(Values), Values) as Values,

    Values2

FROM

[https://community.qlik.com/thread/170764]

(html, codepage is 1252, embedded labels, table is @1);

Output:

Capture.PNG

avinashelite

try like this

in expression:

if(len(values)<=0,Values2/2,values)

In script

LOAD Names,

if(len(values)<=0,Values2/2,values)  as Values,

value2

from table;

Not applicable
Author

Hi Gallina,

my mistake it was sup to be 10.

Thanks.

Not applicable
Author

Hi,

Again is this issue possible to Use on Front End? than Back End?

Thanks.

sunny_talwar

Yes, check Avinash R‌‌ solution, he has provided you with the front end solution as well.