Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
venkatasuresh
Creator
Creator

Help me on creating flags with range(LOW/MEDIUM/HIGH)

Hi Experts ,

Need your help on below Data flagging range(LOW/MEDIUM/HIGH)

Data i have as input :

Tab 1:

LOAD * INLINE [

Country

OTHER

"OTHER,INDIA"

USA

UK

"UK,INDIA"

INDIA

"INDIA,USA"

BLANK

];

Types of Priority_risk as need:

INDIA--->LOW

UK------>MEDIUM

USA----->HIGH

OTHER--->HIGH

BLANK--->LOW

Expected output:

OTHER-------->HIGH

OTHER,INDIA-->HIGH

USA---------->HIGH

UK----------->MEDIUM

UK,INDIA----->MEDIUM

INDIA-------->LOW

INDIA,USA---->HIGH

BLANK-------->LOW

Note: If Priority_risk > 1 value (i.e some times country have more than one priority)THEN use the one with the highest risk

Ex:-(OTHER,INDIA-->HIGH).


Thanks,

Suresh V.V

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

May be this

MapTable:
Mapping
LOAD * Inline [
A,B
INDIA,1
UK,2
USA,3
OTHER,3
BLANK,1]
;

LOAD * Inline [
Priority,Risk
1,LOW
2,MEDIUM
3,HIGH]
;

Tab1:
LOAD Country,Max(Priority1) as Priority Group By Country;
LOAD Country,SubField(Priority,',') as Priority1,Priority;
LOAD *,MapSubString('MapTable',Country) as Priority INLINE [
Country
OTHER
"OTHER,INDIA"
USA
UK
"UK,INDIA"
INDIA
"INDIA,USA"
BLANK]
;

View solution in original post

4 Replies
Sergey_Shuklin
Specialist
Specialist

Hello!

You can use Index() function for searching some text within the string.

And you should use risk numeric indication, like 0 - low, 1 - medium, 2 - high. And after that you can pick the highest risk status using max() function and grouping.

antoniotiman
Master III
Master III

May be this

MapTable:
Mapping
LOAD * Inline [
A,B
INDIA,1
UK,2
USA,3
OTHER,3
BLANK,1]
;

LOAD * Inline [
Priority,Risk
1,LOW
2,MEDIUM
3,HIGH]
;

Tab1:
LOAD Country,Max(Priority1) as Priority Group By Country;
LOAD Country,SubField(Priority,',') as Priority1,Priority;
LOAD *,MapSubString('MapTable',Country) as Priority INLINE [
Country
OTHER
"OTHER,INDIA"
USA
UK
"UK,INDIA"
INDIA
"INDIA,USA"
BLANK]
;

Mark_Little
Luminary
Luminary

Hi,

Take a look at the attached app.

Mark

venkatasuresh
Creator
Creator
Author

Thank You all for your valuble time

Thanks,

Suresh V.V