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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
PrashantRupani
Creator
Creator

Replace missing with 'Data Missing'/N/A

The data I have  looks like this

Table_1:

Emp_ID

101,

102,

103

Table 2: 

Emp_ID, Region 1 Manager, Region 2 Manager, Region 3 Manager

101   , John, Dave , 

102,  Joe, 

 

Emp 101 has Region 1 Manager as John and Region 2 Manager as Dave. Since 101 are themselves a Region 3 Manager hence there is no data populated for that. In such cases , I would like to display 'N/A'.

But for 103, There is no manager in any of the columns. So it should say 'Data Missing' in such case.

The final data should look like - How should I implement this in load script. Is this possible in load script or chart expression or both

 

Emp_ID, Region 1 Manager, Region 2 Manager, Region 3 Manager

101   , John, Dave , N/A

102,  Joe, N/A, N/A

103, Data Missing, Data Missing, Data Missing

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan
MVP
MVP

HI @PrashantRupani 

Try like below

A:
LOAD * INLINE [
Emp_ID
101
102
103
];
B:
LOAD Emp_ID,Emp_ID as E1, If(trim(len([Region 1 Manager])) = 0, 'N/A', [Region 1 Manager]) as [Region 1 Manager]
, If(trim(len([Region 2 Manager])) = 0, 'N/A', [Region 2 Manager]) as [Region 2 Manager]
, If(trim(len([Region 3 Manager])) = 0, 'N/A', [Region 3 Manager]) as [Region 3 Manager] INLINE [
Emp_ID, Region 1 Manager, Region 2 Manager, Region 3 Manager
101 , John, Dave,
102, Joe,
];

Concatenate(B)
Load Emp_ID, 'Data Missing' as [Region 1 Manager], 'Data Missing' as [Region 2 Manager], 'Data Missing' as [Region 3 Manager] Resident A Where not Exists(E1, Emp_ID);

DROP Field E1;

If you're data has null values instead of missing values for Regional manager, try like below

NullAsValue [Region 2 Manager],[Region 3 Manager];

Set NullValue = 'N/A';

 

Replace inline table with ur source

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

View solution in original post

2 Replies
MayilVahanan
MVP
MVP

HI @PrashantRupani 

Try like below

A:
LOAD * INLINE [
Emp_ID
101
102
103
];
B:
LOAD Emp_ID,Emp_ID as E1, If(trim(len([Region 1 Manager])) = 0, 'N/A', [Region 1 Manager]) as [Region 1 Manager]
, If(trim(len([Region 2 Manager])) = 0, 'N/A', [Region 2 Manager]) as [Region 2 Manager]
, If(trim(len([Region 3 Manager])) = 0, 'N/A', [Region 3 Manager]) as [Region 3 Manager] INLINE [
Emp_ID, Region 1 Manager, Region 2 Manager, Region 3 Manager
101 , John, Dave,
102, Joe,
];

Concatenate(B)
Load Emp_ID, 'Data Missing' as [Region 1 Manager], 'Data Missing' as [Region 2 Manager], 'Data Missing' as [Region 3 Manager] Resident A Where not Exists(E1, Emp_ID);

DROP Field E1;

If you're data has null values instead of missing values for Regional manager, try like below

NullAsValue [Region 2 Manager],[Region 3 Manager];

Set NullValue = 'N/A';

 

Replace inline table with ur source

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

This worked. Thanks @MayilVahanan