Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Below is a Sample Data i have:
Names | Values | Values2 |
---|---|---|
jk8912 | 10 | 20 |
Nami001 | - | 100 |
mo024 | 2000 | 4000 |
hon343 | - | 50 |
brt110 | 2500 | 5000 |
Output that i want
Names | Values |
---|---|
jk8912 | 12 |
Nami001 | 50 |
mo024 | 2000 |
hon343 | 25 |
brt110 | 2500 |
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).
Maybe like
LOAD Names,
if(len(trim(Values)), Values, [Values2] / 2) as Values
FROM YourTableSource;
I think you can do it like this:
If(Len(Values) > 0, Values, Values ÷ 2)
Hope this helps.
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
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
];
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:
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;
Hi Gallina,
my mistake it was sup to be 10.
Thanks.
Hi,
Again is this issue possible to Use on Front End? than Back End?
Thanks.
Yes, check Avinash R solution, he has provided you with the front end solution as well.