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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
younlim91
Contributor II
Contributor II

Get a percentage based on the parent value from different column

Hello,

I want something like below in column C. What would be the expression to use for this? Basically, Column C is column A/ parent value in column B

  A B C
X 10 20 0.5
   Y 3   0.15
   Z 7   0.35
D 20 100 0.2
  E 10   0.1
Labels (1)
1 Solution

Accepted Solutions
Iswarya_
Creator
Creator

Hi @younlim91 

You can use IsNull() and Peek() to achieve this. Attached script.

 

test:
LOAD
trim(replace(F1,chr(160),'')) as F1,
A,
"B"
FROM [lib://AttachedFiles/test data.xlsx]
(ooxml, embedded labels, table is Sheet1);

Final:
LOAD *,
A/B1 as C;

Load *,
IF(IsNull(B),Peek(B1),B) AS B1
Resident test;
DROP Table test;

Iswarya__0-1645602446640.png

 

View solution in original post

2 Replies
Iswarya_
Creator
Creator

Hi @younlim91 

You can use IsNull() and Peek() to achieve this. Attached script.

 

test:
LOAD
trim(replace(F1,chr(160),'')) as F1,
A,
"B"
FROM [lib://AttachedFiles/test data.xlsx]
(ooxml, embedded labels, table is Sheet1);

Final:
LOAD *,
A/B1 as C;

Load *,
IF(IsNull(B),Peek(B1),B) AS B1
Resident test;
DROP Table test;

Iswarya__0-1645602446640.png

 

Iswarya_
Creator
Creator

If the issue is solved please mark the answer with Accept as Solution